2

I'm trying to use selenium to open a webpage with code below

from selenium import webdriver

driver = webdriver.Chrome()
driver.get('bing.com')

i tried to use executable_path= but it said chromedriver needs to be in PATH so I added the driver to the path variables and I think that's not the problem

and also i'm using WSL2

here is the full error

Traceback (most recent call last):
  File "/mnt/d/project/src/main.py", line 9, in <module>
    driver = webdriver.Chrome()
  File "/home/amirhosein/.local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
    self.service.start()
  File "/home/amirhosein/.local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 98, in start
    self.assert_process_still_running()
  File "/home/amirhosein/.local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 109, in assert_process_still_running
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 1
Amirhosein Arabhaji
  • 472
  • 1
  • 6
  • 14
  • When you say your running wsl2, does that mean you have the right version of chromedriver? linux version vs`windows version depending on what you're running your test on? - Can you also confirm your versions? - run `pip show selenium` `python --vesrion` and (wherever the chromedriver sleeps) `chromedriver --version` – RichEdwards Aug 08 '20 at 17:42
  • You may find some useful tips here: https://stackoverflow.com/questions/63290844/how-to-run-selenium-chromedriver-from-python3-on-wsl2 – Brian Z Mar 26 '21 at 23:19

1 Answers1

0

Install selenium on the windows or mac operating system instead of linx or wsl. I ran into the same problem and using window resolved the issue, sorry for he lack of reasoning why.

best of luck