from selenium import webdriver from selenium.webdriver.chrome.options import Options # Set up the Chrome options chrome_options = Options() chrome_options.add_experimental_option('debugger_address', 'localhost:9222') # Connect to the running instance of Chrome driver = webdriver.Chrome(options=chrome_options) # Now you can use WebDriver commands to interact with the browser driver.get('https://www.google.com')
from selenium import webdriver from selenium.webdriver.chrome.options import Options # Set up the Chrome options chrome_options = Options() chrome_options.add_argument('--remote-debugging-port=9222') # Connect to the running instance of Chrome driver = webdriver.Chrome(options=chrome_options) # Now you can use WebDriver commands to interact with the browser driver.get('https://www.google.com')This is a similar example, but instead of using the `add_experimental_option` method, we use the `add_argument` method with the `--remote-debugging-port` option to specify the port number to use for the remote debugger. The rest of the code is the same. The package/library used here is `selenium`.