PChao
PChao

Reputation: 439

How to click a browser tab to bring it to front in python selenium?

Using python selenium, I did: driver.get(base_url) and it enter image description here

The only problem is: it went into the tab in the background(attached picture no.2), how do click on that tab which will it to the front?

Upvotes: 1

Views: 221

Answers (1)

cruisepandey
cruisepandey

Reputation: 29362

I think that's an windows handles issue.

you can have your web driver focus on second tab with the below code :

driver.switch_to.window(driver.window_handles[1])

Upvotes: 1

Related Questions