selenium.common.exceptions.WebDriverException: Message: invalid argument: value must be a non-negative integer with ChromeDriver and Selenium

人盡茶涼 提交于 2019-12-13 02:55:34

问题


I am working on selenium (3.5.0),Python 3.6.8 i wanted to test simple code that is written below

driver.implicitly_wait(10)
driver.get(url)
print(driver.title)
sleep(6)
driver.close()

but it is throwing an error i.e selenium.common.exceptions.WebDriverException: Message: invalid argument: value must be a non-negative integer I am not getting where i went wrong

I found similar issue raised by someone in this platform but my problem didn't get solved please help me in this regard


回答1:


This error message...

selenium.common.exceptions.WebDriverException: Message: invalid argument: value must be a non-negative integer

...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.


Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • Presumably you are using the latest chromedriver=77.0
  • Presumably you are using chrome= 77.0.
  • Your Selenium Client version is 3.6.8 which is ancient.

So there is a clear mismatch between the Selenium Client v3.6.8 , ChromeDriver v77.0 and the Chrome Browser v77.0


Solution

Ensure that:

  • Selenium is upgraded to current levels Version 3.141.59.
  • ChromeDriver is updated to current ChromeDriver v77.0 level.
  • Chrome is updated to current Chrome Version 77.0 level. (as per ChromeDriver v77.0 release notes)
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
  • Take a System Reboot.
  • Execute your @Test as non-root user.
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.


来源:https://stackoverflow.com/questions/58184784/selenium-common-exceptions-webdriverexception-message-invalid-argument-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!