Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Web Page not opening while web scraping through python selenium
#1
I am writing codes to do web crawling in windows environment, and using google chrome and mozila firefox as browser. For google chrome I downloaded latest chromedriver and the latest geckodriver for firefox and added path of these drivers in the environment variables.
A sample code is given below which I am executing for google chrome -

from selenium import webdriver

driver = webdriver.Chrome("C:\\ChromeDriver\\chromedriver.exe")
driver.get("https://www.google.com")
In this case the web browser is opening but the google page didn't opened and the whole page remains white after staying like this for certain times the below error is coming. The image of the browser is attached.
Error:
c:\ChromeDriver>python sparrow.py [4064:8324:1119/150817.243:ERROR:install_util.cc(691)] Failed to read HKLM\SOFTWARE\Policies\Google\Chrome\MachineLevelUserCloudPolicyEnrollmentToken: The system cannot find the file specified. (0x2) DevTools listening on ws://127.0.0.1:50164/devtools/browser/f68ff514-1e83-403b-b8a3-61adfc50b15d Traceback (most recent call last): File "sparrow.py", line 3, in <module> driver = webdriver.Chrome("C:\\ChromeDriver\\chromedriver.exe") File "C:\Users\CSURV5\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__ desired_capabilities=desired_capabilities) File "C:\Users\CSURV5\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__ self.start_session(capabilities, browser_profile) File "C:\Users\CSURV5\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "C:\Users\CSURV5\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute self.error_handler.check_response(response) File "C:\Users\CSURV5\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: chrome not reachable (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17134 x86_64)
The below code is for the firefox -
from selenium import webdriver

driver = webdriver.Firefox("C:\\ChromeDriver\\")
driver.get("https://www.google.com")
I am not getting any output after executing the code, even the browser is not also opening. After some time this error message has been thrown.
Error:
Traceback (most recent call last): File "sparrow.py", line 3, in <module> driver = webdriver.Firefox("C:\\ChromeDriver\\") File "C:\Users\CSURV5\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 164, in __init__ self.service.start() File "C:\Users\CSURV5\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\common\service.py", line 104, in start raise WebDriverException("Can not connect to the Service %s" % self.path) selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service geckodriver
Please let me know the exact reason, why I am getting these error?


Attached Files Thumbnail(s)
   
Quote
#2
see: https://python-forum.io/Thread-Web-scraping-part-2
Quote
#3
Quote:driver = webdriver.Chrome("C:\\ChromeDriver\\chromedriver.exe")
what is the permissions of C:\ChromeDirver?

Quote:
driver = webdriver.Firefox("C:\\ChromeDriver\\")
As for firefox it appears you are just passing the same directory to it. Where is geckodriver?
Quote
#4
(Nov-19-2018, 12:23 PM)metulburr Wrote:
Quote:what is the permissions of C:\ChromeDirver?

The directory ChromeDriver has full permission.

Quote:As for firefox it appears you are just passing the same directory to it. Where is geckodriver?
geckodriver and chromedriver is in the same directory C:\ChromeDriver
Quote
#5
(Nov-19-2018, 10:57 AM)sumandas89 Wrote: Failed to read HKLM\SOFTWARE\Policies\Google\Chrome\MachineLevelUserCloudPolicyEnrollmentToken:
It complains that you don't have this key is register.
I check i don't have this key,but work fine without for me.
Try add key to register follow this.

Also basic stuff if you make a folder ChromeDriver with chrome and gecko driver in it,you will need to add that path(C:\ChromeDriver) to Windows Path(Restart Pc).
How to Edit/Add Your System PATH
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  use Xpath in Python :: libxml2 for a page-to-page skip-setting apollo 2 362 Mar-19-2020, 06:13 PM
Last Post: apollo
  Scraping next page of LinkedIn jobs RiteshMahto 6 575 Dec-09-2019, 09:43 PM
Last Post: Larz60+
  Scraping .aspx page Larz60+ 19 27,487 Nov-25-2019, 05:45 PM
Last Post: Larz60+
  Selenium get data from newly accessed page hoff1022 2 411 Oct-09-2019, 06:52 PM
Last Post: hoff1022
  Scraping data from ebay seller page yuvalta 3 2,697 Sep-25-2019, 04:22 AM
Last Post: sandramoraes
  Web scraping (selenium (i think)) Larz60+ 10 1,708 Jan-27-2019, 02:57 AM
Last Post: Larz60+
  Selenium Parsing (unable to Parse page after loading) oneclick 6 1,126 Jan-13-2019, 03:10 AM
Last Post: oneclick
  Difficult web page -- Selenium Larz60+ 2 692 Dec-31-2018, 06:51 PM
Last Post: Larz60+
  web scraping with selenium and bs4 Prince_Bhatia 2 1,350 Sep-18-2018, 10:59 AM
Last Post: Prince_Bhatia
  Selenium opening pdf in new window test 6 2,668 Sep-15-2018, 07:55 PM
Last Post: test

Forum Jump:


Users browsing this thread: 1 Guest(s)