Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: 'WebDriver' object has no attribute 'switch_to_window_handles'

I'm trying to write this code using Selenium and Python to skip to next windows of browser:

browser.switch_to_window_handles(browser.window_handles[-1])

But I don't understand why this error occured, please help me

error: AttributeError: 'WebDriver' object has no attribute 'switch_to_window_handles'

like image 528
João Felipe Holanda Avatar asked Jun 18 '26 07:06

João Felipe Holanda


1 Answers

Try this:

browser.switch_to.window(browser.window_handles[-1])
like image 75
mkhurmi Avatar answered Jun 19 '26 22:06

mkhurmi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!