Run Selenium In Current Chrome Browser

Control The Current Chrome Browser With Python

Here's how to get your python scripts to control Chrome for debugging purposes without having Selenium open up a new browser itself.

Start Chrome from the terminal with this command.

/Applications/Google\\ Chrome --remote-debugging-port=9222 --user-data-dir="~/ChromeProfile"

I like Splinter as I find it easier to write.

from splinter import Browser
from import Options

chrome_options = Options()
chrome_options.add_experimental_option('debuggerAddress', '')
browser = Browser('chrome', options=chrome_options)


Then you can go about doing your usual thing. You can read about how to control the browser in this post here: Browser Automation With Splinter - Guide The Ghost In The Machine!

Thanks for reading. x