Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
3.3k views
in Selenium by
How to get browser name from webdriver instance?

1 Answer

0 like 0 dislike
by
 
Best answer

You can try below code:

 

Capabilities cap = ((RemoteWebDriver) driver).getCapabilities();
String browserName = cap.getBrowserName().toLowerCase();
System.out.println(browserName);
String os = cap.getPlatform().toString();
System.out.println(os);
String v = cap.getVersion().toString();
System.out.println(v);


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...