© Courtney Zhan, Edited by Zhimin Zhan 2024
Z. Zhan (ed.)Selenium WebDriver Recipes in C#https://doi.org/10.1007/979-8-8688-0023-8_16

16. Browser Profile and Capabilities

Courtney Zhan1  
(1)
Fitzgibbon, QLD, Australia
 

Selenium can start browser instances with various profile preferences, which can be quite useful. Obviously, some preference settings are browser-specific, so you might take some time to explore. This chapter will cover some common usages.

Get Browser Type and Version

Detecting your browser type and version is useful for writing custom test scripts for different browsers.
driver = new FirefoxDriver();
ICapabilities caps = ((OpenQA.Selenium.WebDriver)driver).Capabilities;
String browserName = caps.GetCapability("browserName").ToString(); ...

Get Selenium WebDriver Recipes in C#: Practical Testing Solutions for Selenium WebDriver now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.