简体   繁体   中英

selenium instagram bot but the xpath is not working

First I thought that the webdriver is not able to find the xpath but even if include implicit wait. it still throws me the error

def login(self):
    driver = self.driver
    driver.get("https://www.instagram.com/")
    driver.implicitly_wait(10)
    login_button = driver.find_element_by_xpath("//a[@href='/accounts/login/']")
    login_button.click()
    time.sleep(6)
    user_name_elem = driver.find_element_by_xpath("//input[@name='username']")
    user_name_elem.clear()
    user_name_elem.send_keys(self.username)
    passworword_elem = driver.find_element_by_xpath("//input[@name='password']")
    passworword_elem.clear()
    passworword_elem.send_keys(self.password)
    passworword_elem.send_keys(Keys.RETURN)
    time.sleep(6)

File "crawl_profile.py", line 35, in login user_name_elem = driver.find_element_by_xpath("//input[@name='username']") File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 293, in find_element_by_xpath return self.find_element(by=By.XPATH, value=xpath) File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 752, in find_element 'value': value})['value'] File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute self.error_handler.check_response(response) File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: missing or invalid 'entry.level' (Session info: chrome=67.0.3396.99) (Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Mac OS X 10.13.6 x86_6 4)

You need to update your chromedriver.exe to latest version.

Now you are using old chromedriver version (Session info: chrome=67.0.3396.99) (Driver info: chromedriver=2.27.440174)

You need to use : (ChromeDriver 2.39) (Supports Chrome v66-68)

Please refe this link :- chroemdriver latest version updates

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM