browserless docs

browserless docs

  • Quick Start
  • Docker
  • Libraries
  • FAQ
  • Blog
  • Sign-up

›Libraries

Hosted Service

  • Quick Start
  • How it works
  • GraphQL API
  • Best Practices
  • Terminology
  • Using your token

Docker

  • Quick Start
  • Configuration
  • Webhooks
  • Extending

APIs

  • /content
  • /download
  • /function
  • /pdf
  • /screencast
  • /screenshot
  • /scrape
  • /stats
  • /workspace

Libraries

  • Puppeteer
  • Playwright
  • Selenium
  • Capybara
  • .NET
  • Java
  • Python
  • Go (chromedp)

Recipes

  • Dealing with downloads
  • Using a Proxy
  • Watching sessions

Options

  • Launch Options
  • Using API /GET

Python (Selenium)

You can use your existing python infrastructure today with browserless by using the selenium webdriver library.

As with most selenium libraries, you'll need to install the webdriver dependency, and set browserless as your remote webdriver. You'll also use set_capability to specify your browserless.io token when making requests to the hosted service.

Below is a small example of getting started:

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('browserless:token', 'YOUR-API-TOKEN')
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--headless")

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

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

This will simply navigate to the Example website and print the title, however it'll give you a great starting place for using Java Selenium alongside browserless.

Be sure to let us know if you have questions or issues.

← JavaGo (chromedp) →
browserless docs
Docs
Quick StartDocker DocsChrome API
Community
SlackTwitter
More
GitHubStar