Skip to main content

Authentication with Selenium

tip

Authentication as a user is performed using an accessKey.

The Access Key can either be passed as part of the capabilities or as part of the URL.

Capabilities authentication   

For accessKey, use the following convention:

DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability("accessKey", "<accessKey>");

RemoteWebDriver driver = new RemoteWebDriver(new URL(cloudurl + "/wd/hub/"), dc);

URL authentication 

For accessKey, use the following convention:

WebDriver driver = new RemoteWebDriver(new URL("http://:" + accessKey + "@" + host+":" + port + "/wd/hub/"), dc);