K
K
kapernikxd2019-02-27 20:01:24
Python
kapernikxd, 2019-02-27 20:01:24

How to run Selenium Webdriver in an already open browser?

I use this code:
from selenium import webdriver
url =' https://google.com '
def page():
global driver
driver = webdriver.Chrome()
driver.get(url)
def main():
page()
if __name__ = = '__main__':
main()
How can I make it so that when the code is run, it opens a new tab in the already running Chrome/Firefox browser, and not a new browser page?
Those. I'm opening Chrome and I want a new tab to be added when I run the code in that Chrome browser.
Please help, I'm not very friendly with Python.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2019-02-27
@dimonchik2013

Why did you provide the code?
it is possible to do this, but not easy, and it will not be Chrome

D
Dmitry Eremin, 2019-02-27
@EreminD

How did you launch the browser? Code or hands?
If by hand, then you will not be able to connect to the existing browser

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question