Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium, Python and InvalidArgumentException: invalid argument: value must be a non-negative integer [duplicate]

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

like image 713
krishna Avatar asked Oct 01 '19 12:10

krishna


1 Answers

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.
like image 98
undetected Selenium Avatar answered Nov 15 '22 07:11

undetected Selenium