Home > Software design >  ImportError using Seleniumwire
ImportError using Seleniumwire

Time:02-26

I can't figure out what is causing the error. Python 3.9, 3.10.

Traceback (most recent call last):
  File "C:\Users\User\Desktop\S\SS\test.py", line 1, in <module>
    from seleniumwire import webdriver
  File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\seleniumwire\webdriver.py", line 14, in <module>
    from selenium.webdriver import TouchActions  # noqa
ImportError: cannot import name 'TouchActions' from 'selenium.webdriver' (C:\Users\User\AppData\Roaming\Python\Python39\site-packages\selenium\webdriver\__init__.py)

Code:

from seleniumwire import webdriver

CodePudding user response:

To use Selenium Wire first you have to install selenium-wire as follows;

pip install selenium-wire

Note: If you get an error about not being able to build cryptography you may be running an old version of pip. You need to try upgrading pip with python -m pip install --upgrade pip and then re-run the above mentioned command.

Now you can proceed with the import as:

from seleniumwire import webdriver

CodePudding user response:

Its a bug: GitHub issue

Just need to download selenium 4.1.0 with:

pip install selenium==4.1.0
  • Related