Requesting for non-registered capabilities

The hub will reject the request from the test script when the test script asks for a capability that is not registered with the hub. Let's modify the preceding test script to request the Opera browser instead of Chrome. The test script should look as follows:

@BeforeMethodpublic void setup() throws MalformedURLException {    DesiredCapabilities caps = new DesiredCapabilities();    caps.setBrowserName("opera");    caps.setPlatform(Platform.MAC);    driver = new RemoteWebDriver(new URL("http://192.168.0.101:1111/wd/hub"), caps);    driver.get("http://demo-store.seleniumacademy.com/");}

The hub checks whether there is any node that matches the desired capabilities. If it doesn't find one (as in this case), it will ...

Get Selenium WebDriver 3 Practical Guide - Second Edition 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.