user2565010
user2565010

Reputation: 2030

How to run selenium python script in current window session?

When I'm writing a selenium python script, I have to start a session with some command like

driver = webdriver.Firefox()

However, this opens a new browser window.

What I would like is to have the window that is already open be accessed by the script, much like it would be if I have started the selenium IDE add-on (that cannot run python scripts afaik).

Could anybody please tell me if there is a way to do that?

Upvotes: 4

Views: 4484

Answers (1)

Daniel
Daniel

Reputation: 2459

I've often wanted this functionality with Selenium and Python myself. Unfortunately, it's not part of Selenium's current features.

For more info, check out the answer threads here:

Can Selenium interact with an existing browser session?

(looks like someone came up with a hack solution, but I haven't tested it)

and here:

Can Selenium webdriver attach to already open browser window?

Good luck!

Upvotes: 2

Related Questions