1.

Explain Desired capabilities in Selenium with one example?

Answer»

Desired CAPABILITIES is used to set properties for the WebDriver. It is also used to set the properties of browser such as to set BrowserName, Platform, Version of Browser etc.

Example :

STRING baseUrl , nodeUrl; baseUrl = "https:// https://www.seleniumhq.org/ "; nodeUrl = "http://192.168.10.21:5568/wd/hub"; DesiredCapabilities dcap = DesiredCapabilities.FIREFOX(); dcap.setBrowserName("firefox"); dcap.setPlatform(Platform.WIN10_1); driver = new RemoteWebDriver(new URL(nodeUrl),dcap); driver.manage().window().MAXIMIZE(); driver.manage().TIMEOUTS().implicitlyWait(30, TimeUnit.SECONDS);


Discussion

No Comment Found