0

Using python with selenium, fragment of the code:

  alert = driver.switch_to_alert().accept()

By run the code, i get:

  Warning (from warnings module):
  File "C:\Python34\selenium\webdriver\remote\webdriver.py", line 517
  warnings.warn("use driver.switch_to.alert instead", DeprecationWarning)
  DeprecationWarning: use driver.switch_to.alert instead

I dont understand this, Didn't i just use driver.switch_to.alert?

1 Answer 1

1

Take a closer look at the name of the call - once it's written with an underline, once with a dot inbetween. You are using the method switch_to_alert() of your driver object - it seems like Selenium has deprecated this method in favor of a seperated switch_to subclass / property.

So you should use the method alert() of switch_to of driver, but you are using switch_to_alert() of driver.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.