seleniumbase / SeleniumBase

📊 Python's all-in-one framework for web crawling, scraping, testing, and reporting. Supports pytest. UC Mode provides stealth. Includes many tools.
https://seleniumbase.io
MIT License
4.46k stars 909 forks source link

Wire Mode: `No module named 'blinker._saferef'` if installing `selenium-wire` alone #2782

Closed mdmintz closed 1 month ago

mdmintz commented 1 month ago

Wire Mode: No module named 'blinker._saferef' if installing selenium-wire alone.


Wire Mode (--wire / wire=True) uses the selenium-wire library. The selenium-wire library has a dependency on blinker. The latest version of blinker no longer has blinker._saferef, which selenium-wire needs. This leads to ModuleNotFoundError: No module named 'blinker._saferef'.

Since https://github.com/wkeeling/selenium-wire is no longer maintained (and therefore won't make changes or pin dependencies) it's up to SeleniumBase to make the necessary changes. One way is by forcing blinker==1.7.0, which does not have the issue.

Because Wire Mode is optional, I don't want to create a dependency on blinker==1.7.0 in the standard SeleniumBase dependencies. Instead, this issue can be fixed by automatically installing blinker==1.7.0 in Wire Mode if that is not the current version of blinker.

mdmintz commented 1 month ago

This was resolved in seleniumbase 4.27.0: https://github.com/seleniumbase/SeleniumBase/releases/tag/v4.27.0

For regular selenium-wire users who aren't using SeleniumBase, run this:

pip install blinker==1.7.0