问题
I click a button which opens a new tab. How to I then navigate around the new tab?
This sounds like a simple task but after several hours trying to find a solution I'm not any closer. Is there a simple way of doing this?
Tried using keys for CONTROL + 'T' and read other suggestions but nothing seems to work.
Many thanks
回答1:
I just implemented my solution and it worked for my case, which looks very similar to yours.
First you need to check the window_handles
:
len(driver.window_handles) > 1
If you have more than one, you can try to switch to your second handler:
driver.switch_to_window(driver.window_handles[1])
来源:https://stackoverflow.com/questions/38948190/python-selenium-with-chrome-how-to-switch-between-different-tabs