Selenium and WebDriver
Your Selenium scripts drive a Lumen profile as they drive Safari: every profile has its own WebDriver address, and the commands run in its real Safari window.
On this page
Connecting
- Open Scenarios (⇧⌘E), choose Automation API on the left and turn on Let scripts on this Mac drive the profiles.
- Copy the profile’s address: in the profile panel on the right, the WebDriver Address row (the token as dots; its button copies the whole address), or Copy WebDriver Address in the profile’s ⋯ menu.
- In your script connect to that address through
webdriver.Remote.
The address works on this Mac only (127.0.0.1) and holds the automation API’s token: whoever has the address drives the profile - keep it as you keep the token. When the API is off or not in your plan, the profile panel has a Selenium row instead, which opens where that is settled.
An example in Python
from selenium import webdriver
from selenium.webdriver.common.by import By
# The profile panel: WebDriver Address → Copy
driver = webdriver.Remote(
command_executor="http://127.0.0.1:50777/wd/<token>/<profile>",
options=webdriver.SafariOptions())
driver.implicitly_wait(10)
driver.get("https://example.com/login")
driver.find_element(By.CSS_SELECTOR, "#email").send_keys("name@example.com")
driver.find_element(By.XPATH, "//button[@type='submit']").click()
print(driver.find_element(By.CSS_SELECTOR, "h1").text)
driver.save_screenshot("after.png")
driver.quit() # closes the window; a profile the session started is stoppedAny browser options will do: the browser is always the profile, whatever is named.
The session and the profile
- A new session starts the profile if it is stopped, and drives its real Safari window.
- A profile has one session at a time. Ending it closes its window, and stops the profile when the session started it; a profile that was running stays.
- A page sees nothing new:
navigator.webdriverstaysfalse, and clicks and keys come through the same human-like input as in scenarios. - Scripts from
execute_scriptrun in the driver’s own world: the DOM is the same, an element can go in and come out, but the page’s own JavaScript variables are not seen.
What it does
Navigation (back, forward, refresh), finding elements by CSS, XPath, link text and tag name with the implicit wait, click, typing (with Enter, Tab, arrows and modifiers), reading text, attributes, properties and CSS, running a script, the page’s cookies, a screenshot of the window or an element, the window’s size, timeouts.
What is not there
- embedded frames, the page’s dialogs (alert, confirm), several windows or tabs in one session;
- the Actions API (ActionChains), file uploads, printing.
Each such command answers with the protocol’s own error - “unsupported operation” or “no such alert”.
And Playwright?
Playwright cannot be connected: it drives only its own builds of browsers. Its script moves into a Lumen scenario almost as it is - a scenario’s commands have the same names (page.goto, page.click, page.type, page.waitFor, page.evaluate), and a scenario can be started from outside through the local API. See “Automation: scenarios and the API”.
Selenium and WebDriver are part of automation: they are in Professional and Team. Without them Lumen refuses a new session and says why.
Found a mistake, or is something missing? Write to us.