How to get browser information in C # WebDriver?

I see the ICapabilities interface for getting browser information; multiple passwords without any good code examples; Can anyone share any message on how I can get browser information for a specific instance of IWebDriver? I am using C # web editor.

+4
source share
2 answers

To get the information defined in the ICapabilities interface, you need to include the IWebDriver instance in RemoteWebDriver . You can then get information about BrowserName , IsJavaScriptEnabled , Platform and Version .

 IWebDriver driver = new FirefoxDriver(); ICapabilities capabilities = ((RemoteWebDriver)driver).Capabilities; // then you have // capabilities.BrowserName; // capabilities.IsJavaScriptEnabled; // capabilities.Platform; // capabilities.Version; 
+10
source

I came across an easier way if you just need to know which driver works to get around the hack:

.

Driver.GetType () ToString ();

-1
source

All Articles