kaliiiiiiiiii / Selenium-Driverless

undetected Selenium without usage of chromedriver
https://kaliiiiiiiiii.github.io/Selenium-Driverless/
Other
545 stars 66 forks source link

ImportError: DLL load failed while importing _cext: The specified module could not be found. #71

Closed wealthr closed 1 year ago

wealthr commented 1 year ago

code

from selenium_driverless import webdriver
from selenium_driverless.types.by import By
import asyncio

async def main():
    options = webdriver.ChromeOptions()
    async with webdriver.Chrome(options=options) as driver:
        await driver.get('http://nowsecure.nl#relax')
        await driver.sleep(0.5)
        await driver.wait_for_cdp("Page.domContentEventFired", timeout=15)

        # wait 10s for elem to exist
        elem = await driver.find_element(By.XPATH, '/html/body/div[2]/div/main/p[2]/a', timeout=10)
        await elem.click(move_to=True)

        alert = await driver.switch_to.alert
        print(alert.text)
        await alert.accept()

        print(await driver.title)

asyncio.run(main())
C:\Users\Aj\PycharmProjects\pythonProject\venv\Scripts\python.exe C:\Users\Aj\PycharmProjects\pythonProject\main.py 
Traceback (most recent call last):
  File "C:\Users\Aj\PycharmProjects\pythonProject\main.py", line 1, in <module>
    from selenium_driverless import webdriver
  File "C:\Users\Aj\PycharmProjects\pythonProject\venv\lib\site-packages\selenium_driverless\webdriver.py", line 43, in <module>
    from selenium_driverless.input.pointer import Pointer
  File "C:\Users\Aj\PycharmProjects\pythonProject\venv\lib\site-packages\selenium_driverless\input\pointer.py", line 6, in <module>
    from selenium_driverless.types.webelement import WebElement
  File "C:\Users\Aj\PycharmProjects\pythonProject\venv\lib\site-packages\selenium_driverless\types\webelement.py", line 30, in <module>
    from selenium_driverless.scripts.geometry import gen_heatmap, gen_rand_point, centroid
  File "C:\Users\Aj\PycharmProjects\pythonProject\venv\lib\site-packages\selenium_driverless\scripts\geometry.py", line 4, in <module>
    from matplotlib.patches import Polygon
  File "C:\Users\Aj\PycharmProjects\pythonProject\venv\lib\site-packages\matplotlib\__init__.py", line 272, in <module>
    _check_versions()
  File "C:\Users\Aj\PycharmProjects\pythonProject\venv\lib\site-packages\matplotlib\__init__.py", line 266, in _check_versions
    module = importlib.import_module(modname)
  File "C:\Users\Aj\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\Aj\PycharmProjects\pythonProject\venv\lib\site-packages\kiwisolver\__init__.py", line 8, in <module>
    from ._cext import (
ImportError: DLL load failed while importing _cext: The specified module could not be found.

Process finished with exit code 1
kaliiiiiiiiii commented 1 year ago

@wealthr This issue is related to MatPloitLib and out of the scope of this project. Closing therefore

wealthr commented 1 year ago

do you know how can resolve it?, selenium-profile works perfectly well

kaliiiiiiiiii commented 1 year ago

do you know how can resolve it?, selenium-profile works perfectly well

maybe https://github.com/matplotlib/matplotlib/issues/18292/ helps you

wealthr commented 1 year ago

I found that installing Microsoft Visual C++ Redistributable fixes the problem.

You can download it from https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170

kaliiiiiiiiii commented 1 year ago

I found that installing Microsoft Visual C++ Redistributable fixes the problem.

You can download it from https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170

That's might be helpful for others having the same issue, thanks! Also, I'm planning to remove the MatPlotLib dependency:)

tkoyama010 commented 2 months ago

I had the same error in https://github.com/pyvista/pyvista/pull/6458. Adding the --only-binary "matplotlib" option to pip command solved the problem.