From 7a4e799968e8f5e35c7899068880ad74517397e9 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Mon, 18 Oct 2021 11:24:30 -0700 Subject: [PATCH] docs: add Selenium Grid integration (#9582) --- docs/src/selenium-grid.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 docs/src/selenium-grid.md diff --git a/docs/src/selenium-grid.md b/docs/src/selenium-grid.md new file mode 100644 index 0000000000..70f92c4e53 --- /dev/null +++ b/docs/src/selenium-grid.md @@ -0,0 +1,38 @@ +--- +id: selenium-grid +title: "Selenium Grid" +--- + +Playwright can connect to [Selenium Grid Hub](https://www.selenium.dev/documentation/grid/) to launch **Chrome** browser, instead of running browser on the local machine. To enable this mode, set `SELENIUM_REMOTE_URL` environment variable pointing to your Selenium Grid Hub. + +```bash js +# Playwright Test +SELENIUM_REMOTE_URL=http://internal.grid:4444/wd/hub npx playwright test + +# Playwright Library +SELENIUM_REMOTE_URL=http://internal.grid:4444/wd/hub node script.js +``` + +```bash python +# With Pytest +SELENIUM_REMOTE_URL=http://internal.grid:4444/wd/hub pytest --browser chromium + +# Plain Python +SELENIUM_REMOTE_URL=http://internal.grid:4444/wd/hub python script.py +``` + +```bash java +SELENIUM_REMOTE_URL=http://internal.grid:4444/wd/hub mvn test +``` + +```bash csharp +SELENIUM_REMOTE_URL=http://internal.grid:4444/wd/hub dotnet test +``` + +You don't have to change your code, just use [`method: BrowserType.launch`] as usual. + +When using Selenium Grid Hub, you can [skip browser downloads](./browsers.md#skip-browser-downloads). + +:::note +Internally, Playwright connects to the browser using [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) websocket. This requires Selenium Grid nodes to be directly accessible from the machine that runs Playwright. +:::