Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selenium webdriver error
#1
Hi guys,
I'm very new to Python - trying to use Selenium to scrape dynamic web pages and can't even get over 1st hurdle!!!
from selenium import webdriver
browser = webdriver.Chrome('C:\Program Files (x86)\Google\Chrome\Application\chrome.exe')
browser.get("https://www.python.org/")
The browser opens but does not connect to the requested web page and I get the following error:

Output:
Traceback (most recent call last): File "C:\Users\Shane Duncan\OneDrive\Documents\Trading\MyFxBook Programs\Test code.py", line 32, in <module> browser = webdriver.Chrome('C:\Program Files (x86)\Google\Chrome\Application\chrome.exe') File "C:\Users\Shane Duncan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__ self.service.start() File "C:\Users\Shane Duncan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\common\service.py", line 98, in start self.assert_process_still_running() File "C:\Users\Shane Duncan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\common\service.py", line 111, in assert_process_still_running % (self.path, return_code) selenium.common.exceptions.WebDriverException: Message: Service C:\Program Files (x86)\Google\Chrome\Application\chrome.exe unexpectedly exited. Status code was: 0
I have no idea why I get this error - any help appreciated.
Reply
#2
you need to download chromedriver and link to that, not your local chrome exe
Recommended Tutorials:
Reply
#3
I ran the chromedriver exe file and it opens the cmd window and just sits there ..open
I ran the python code again and same error as before.
Reply
#4
(Feb-09-2020, 11:07 AM)WiPi Wrote: I ran the chromedriver exe file and it opens the cmd window and just sits there ..open
You dont run that directly, you put it in your code's path. Or you can add the chromedriver's directory to Windows PATH variable to not have to put the path in your code.
Recommended Tutorials:
Reply
#5
sorry yes I realised later doh!

Thank you this now works but I am sure I will have plenty more stupid questions as I get into the tough stuff!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need help for script access via webdriver to an open web page in Firefox Clixmaster 1 1,214 Apr-20-2023, 05:27 PM
Last Post: farshid
  Problem with Selenium webdriver Fred 1 2,008 Jan-10-2022, 05:45 PM
Last Post: Larz60+
  How do I iterate over an array and perform actions using selenium chrome webdriver? master 0 2,386 Sep-14-2020, 05:28 AM
Last Post: master
  Which webdriver is required for selenium in Pydroid App Rahatt 1 6,239 Jul-31-2020, 01:39 AM
Last Post: Larz60+
  Log In Button Won't Click - Python Selenium Webdriver samlee916 2 3,770 Jun-07-2020, 04:42 PM
Last Post: samlee916
  Hyperlink Click is not working in Selenium webdriver rajeev1729 0 1,994 May-02-2020, 11:21 AM
Last Post: rajeev1729
  Selenium weird error julio2000 0 1,646 Feb-23-2020, 01:24 PM
Last Post: julio2000
  error when running headless selenium julio2000 2 4,508 Feb-01-2020, 12:41 PM
Last Post: julio2000
  Error clicking button with selenium julio2000 4 5,248 Jan-06-2020, 10:59 AM
Last Post: julio2000
  Selenium error with ebdriver (geckodriver) Martinelli 4 4,663 Sep-24-2019, 01:40 AM
Last Post: Martinelli

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020