Skip to main content

Java (Selenium)

Selenium library for Java by OpenQA is supported by BrowserCloud. You can define your authorization token indicating an extra capability of 'browsercloud.token' like in all our selenium integrations. Make sure you set --headless and --no-sandbox options.

Example

import java.net.*;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.*;
import org.openqa.selenium.remote.*;

public class CloudTest {
public static void main() throws MalformedURLException {

final ChromeOptions chromeOptions = new ChromeOptions();

chromeOptions.addArguments("--no-sandbox");
chromeOptions.addArguments("--headless");
chromeOptions.addArguments("--disable-dev-shm-usage");
chromeOptions.setCapability("browsercloud.token", "YOUR-API-TOKEN");

WebDriver driver = new RemoteWebDriver(
new URL("https://chrome.browsercloud.io/webdriver"),
chromeOptions
);

driver.get("https://www.example.com");
driver.quit();
}
}

You can use Go along with BrowserCloud despite the Title logoff from the Example website.

In case of any questions feel free to contact us: support@browsercloud.io