Skip to main content

Python (Selenium)

Python infrastructure can be used together with BrowserCloud via the selenium webdriver library.

All you have to do is to install the webdriver dependency and set browsercloud as your remote webdriver. To request the hosted service use set_capability to indicate your browsercloud.io token.

Go over the example below:

Example

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

chrome_options = webdriver.ChromeOptions()
chrome_options.set_capability('browsercloud.token', 'MY-TOKEN')
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--headless")

driver = webdriver.Remote(
command_executor='https://chrome-us.browsercloud.io/webdriver',
desired_capabilities=chrome_options.to_capabilities()
)

driver.get("https://www.example.com")
print driver.title
driver.quit()

A starting point for a joint Python and BrowserCloud usage is provided though the Title is logged out from the Example website.

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