Connect to an already open session without opening a new one.
36 views
Skip to first unread message
Aymeric
unread,
Jun 25, 2024, 12:02:56 AM (8 days ago) Jun 25
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Selenium Users
Hi, I'm trying to connect my script to an existing browser session with selenium grid, but the script keep trying to open a new browser.
Here is my code:
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
fromselenium.webdriver.common.byimport By
# Load session info from the filewithopen('session_info.txt', 'r') as file:
session_url, session_id = file.read().splitlines()
print(session_id)
print(session_url)
# Set up Firefox options
options = Options()
options.add_argument("-profile")
options.add_argument(r"C:\Users\########\AppData\Roaming\Mozilla\Firefox\Profiles\########.default")
driver = webdriver.Remote(command_executor=session_url, options=options)