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

Bug #1833448 reported by Jeffrey Walton on 2019-06-19
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-selenium (Ubuntu)
Undecided
Unassigned

Bug Description

I am using Selenium, Python, Chromedriver and Chrome browser to fill in a web form. The script automates filing FTC Do Not Call complaints. The script runs on Armbian, which is Ubuntu Bionic on armv7l.

The problem below is new and arrived today, which is June 19, 2019. File ftc.py:111 is 'implicitly_wait':

    driver.get("https://complaints.donotcall.gov/complaint/complaintcheck.aspx")
    driver.implicitly_wait(2)

I see similar problems with Firefox, but I don't see Chrome (yet). A Firefox example is https://stackoverflow.com/q/46541636/608639.

I've tried to build these tools in the past, like Geckodriver. It looks like no testing occurs on ARM. For ARM, Rust cannot build the Cargo packages, which means Geckodriver cannot be built. Trying to do anything with Rust, Cargo and Geckodriver is a complete waste of time.

-----

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic

-----

Traceback (most recent call last):
  File "./ftc.py", line 281, in <module>
    main()
  File "./ftc.py", line 111, in main
    driver.implicitly_wait(2)
  File "/usr/lib/python3/dist-packages/selenium/webdriver/remote/webdriver.py", line 793, in implicitly_wait
    'implicit': int(float(time_to_wait) * 1000)})
  File "/usr/lib/python3/dist-packages/selenium/webdriver/remote/webdriver.py", line 311, in execute
    self.error_handler.check_response(response)
  File "/usr/lib/python3/dist-packages/selenium/webdriver/remote/errorhandler.py", line 237, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: value must be a non-negative integer
  (Session info: headless chrome=75.0.3770.90)

-----

$ apt-cache show chromium-browser
Package: chromium-browser
Architecture: armhf
Version: 75.0.3770.90-0ubuntu0.18.04.1
Priority: optional
Section: universe/web
Origin: Ubuntu
Maintainer: Ubuntu Developers <email address hidden>

$ apt-cache show python3-selenium
Package: python3-selenium
Architecture: all
Version: 3.8.0+dfsg1-3
Priority: optional
Section: universe/python
Source: python-selenium
Origin: Ubuntu
Maintainer: Ubuntu Developers <email address hidden>

Jeffrey Walton (noloader) wrote :

Here's the reproducer.

#!/usr/bin/env python3

import time
import sys
import selenium
import os.path

from packaging import version
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

def get_chrome():
    if os.path.isfile('/usr/bin/chromium-browser'):
        return '/usr/bin/chromium-browser'
    elif os.path.isfile('/usr/bin/chromium'):
        return '/usr/bin/chromium'
    elif os.path.isfile('/usr/bin/chrome'):
        return '/usr/bin/chrome'
    elif os.path.isfile('/usr/bin/google-chrome'):
        return '/usr/bin/google-chrome'
    else:
        return None

def main():
    if version.parse(selenium.__version__) >= version.parse("3.0"):
        opts = Options()
        opts.binary_location = get_chrome()
        opts.add_argument('--headless')
        opts.add_argument('--no-sandbox')
        opts.add_argument('--disable-dev-shm-usage')

        driver = webdriver.Chrome(chrome_options=opts)
        driver.maximize_window()
    else:
        opts = Options()
        opts.headless = True
        opts.binary_location = get_chrome()

        driver = webdriver.Chrome(chrome_options=opts)
        driver.maximize_window()

    agent = driver.execute_script('return navigator.userAgent')
    driver.get("https://complaints.donotcall.gov/complaint/complaintcheck.aspx")
    driver.implicitly_wait(2)
    driver.quit()

if __name__ == "__main__":
    main()

Jeffrey Walton (noloader) wrote :

Someone on Stack Overflow suggested the installed version of Selenium is incompatible with Chrome 75. I'm trying to find the minimum version of Selenium that should be installed to avoid the issue.

Due to policies and procedures, pip is not an option for us. It is not allowed on our production machines. The only packages allowed are those provided by the distro or the software we write.

If Selenium is the issue, then this probably affects both Bionic and Cosmic since both provide 3.8.0+dfsg1-3. It looks like Disco bumps to 3.14.1+dfsg1-1.

Matt Zimmerman (mdz) wrote :

Confirmed, it looks like python3-selenium is incompatible with the updated chromium-webdriver package in 18.04. As a workaround, the selenium package from PyPI (pip3 install selenium) does work.

Changed in python-selenium (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers