Issue
I'm trying to recover an old script of mine, which has always worked. Since I switched to Python 3 though, I'm having a lot of problems. This error came up after launching the script:
DeprecationWarning: find_element_by_* commands are deprecated
This is the line of the code which presents the problem:
driver.find_element_by_xpath("//*[@title='Consent all cookies']").click()
Can anyone help me?
Solution
You need to add the following import:
from selenium.webdriver.common.by import By
Then replace this:
driver.find_element_by_xpath("//*[@title='Consent all cookies']").click()
with this:
driver.find_element(By.XPATH, "//*[@title='Consent all cookies']").click()
Answered By - WillyWhite
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.