Browser capabilities:
Getting Browser details in selenium is quite easy. Using this we can run our scripts across various machines, various OS, and various browsers (It will be explained in Selenium Grid concept).
Include these two packages into your script
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.Capabilities;
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);
No comments:
Post a Comment