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
  any way to load page in utf-8 encoding adnanahsan 0 49 Yesterday, 01:55 AM
Last Post: adnanahsan
  Python / Selenium Turning Off Alert graham23s 3 313 Aug-18-2019, 02:12 PM
Last Post: metulburr
  Python Selenium .click() Loads Error - Works Manually.- Events not Triggered NSearch 24 817 Aug-14-2019, 02:23 PM
Last Post: NSearch
  Formatting Output After Web Scraping yoitspython 3 187 Aug-01-2019, 01:22 PM
Last Post: snippsat
  Can not point to Selenium Webdriver path for Python Jupyter Notebook on Azure dadadance 4 1,678 Jul-31-2019, 10:00 PM
Last Post: perfringo
  Extracting links from website with selenium bs4 and python M1ck0 1 121 Jul-20-2019, 10:29 PM
Last Post: Larz60+
  Unable to switch out of nested frames into main page abi17124 0 95 Jul-17-2019, 06:06 PM
Last Post: abi17124
  Django Two blocks of dynamic content on one page iFunKtion 5 511 Jul-04-2019, 02:31 AM
Last Post: noisefloor
  web scraping to csv formatting problems bluethundr 4 330 Jul-04-2019, 02:00 AM
Last Post: Larz60+
  Beautifulsoup Scraping PolskaYBZ 3 357 Jun-22-2019, 10:05 AM
Last Post: PolskaYBZ

Forum Jump:


Users browsing this thread: 1 Guest(s)