i have run firefox in debug mode, command as below:
/usr/bin/firefox –no-default-browser-check –no-first-run –no-sandbox –start-maximized –disable-gpu –remote-debugging-port 9222
Then how Can I use selenium to debug it, each time i run selenium script, a new firefox instance will be started
the script is as below:
import os
import time
import json
from selenium import webdriver
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import TimeoutException
options = Options()
driver = webdriver.Firefox(options=options)
url = "ddd"
file_path = "/tmp/result.json"
def save_result(result):
with open(file_path, "w") as file:
json.dump(result, file)
def main():
driver.set_page_load_timeout(10)
try:
driver.get(url)
except Exception as e:
message = f"Failed to load page: {type(e).__name__} - {str(e)}"
result = {
"status": "failure",
"message": message
}
save_result(result)
How can we reproduce the issue?
1、start firefox in debug mode, in macos or ubuntu
2、use try to use selenium to connect it
Selenium version
4.21.0
What are the browser(s) and version(s) where you see this issue?
firefox 126.0.1
What are the browser driver(s) and version(s) where you see this issue?
0.34
Are you using Selenium Grid?
no
Yujie Gai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.