Reputation: 67
I'm a beginner in Python and Selenium, and I dont know what is the error in my code or environment...
# encoding: utf-8
import time
from selenium import webdriver
from bs4 import BeautifulSoup
driver = webdriver.Chrome(executable_path=r'C:/Python27/Scripts/chromedriver')
time.sleep(3)
driver.get('https://www.google.com.tw/')
for i in range(10):
driver.execute_script('window.scrollTo(0, document.body.scrollHeight);')
time.sleep(1)
print ("Scrolling...")
driver.close()
And here is error messages...
C:\Python27\python.exe D:/PythonPratice/test.py Traceback (most recent call last): File "D:/PythonPratice/test.py", line 9, in driver.get('https://www.google.com.tw/') File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 250, in get self.execute(Command.GET, {'url': url}) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 238, in execute self.error_handler.check_response(response) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 193, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"2172.1","isDefault":true},"id":1,"name":"","origin":"://"} (Session info: chrome=56.0.2924.87) (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64)
Process finished with exit code 1
Much thanks!
Upvotes: 0
Views: 2764
Reputation: 52665
Try to download latest version of chromedriver
and put it to C:/Python27/Scripts/
instead of outdated one
Upvotes: 1
Reputation: 7401
you should provide full path of chromedriver.exe
, see the following:
driver = webdriver.Chrome(executable_path=r'C:/Python27/Scripts/chromedriver.exe')
Upvotes: 1