Search code examples
python-3.xseleniumselenium-chromedriverwebdriverlocalhost

what does "add_experimental_option("debuggerAddress", "localhost:8989")" actually do when added to Options() on Python? Selenium related


I'm trying to figure out what's the difference between opening a chrome driver with the following option add_experimental_option("debuggerAddress", "localhost:8989"):

##chromeoptions
opt = Options()
opt.add_experimental_option("debuggerAddress", "localhost:8989")
driver = webdriver.Chrome(
    executable_path=os.path.join(sys.path[0]) + "/chromedriver.exe",
    chrome_options=opt,
)
driver.get('https://www.google.com/')

And opening the same chrome driver but without any option:

driver = webdriver.Chrome(
    executable_path=os.path.join(sys.path[0]) + "/chromedriver.exe")
driver.get('https://www.google.com/')

In what stuff does add_experimental_option("debuggerAddress", "localhost:8989") affect the deployment of the driver?


Solution

  • (Basic answer, im newbie with this)

    Using:

    opt = Options()
    opt.add_experimental_option("debuggerAddress", "localhost:8989")
    

    You can execute selenium scripts on already opened browser.
    See this video and you easily understand:
    https://www.youtube.com/watch?v=Zrx8FSEo9lk&t=432s&ab_channel=Mukeshotwani

    While using the second option, the script open a new browser and run the commands.