Python 3.x Selenium Chromedriver无法从Google云服务器运行
我正试图从一个基本的谷歌云服务器上编写一个网页抓取python脚本。我已经成功地将selenium和chromedriver下载到VM上。当我运行代码时,我返回这个错误 我的python代码是:Python 3.x Selenium Chromedriver无法从Google云服务器运行,python-3.x,linux,macos,selenium,selenium-chromedriver,Python 3.x,Linux,Macos,Selenium,Selenium Chromedriver,我正试图从一个基本的谷歌云服务器上编写一个网页抓取python脚本。我已经成功地将selenium和chromedriver下载到VM上。当我运行代码时,我返回这个错误 我的python代码是: from selenium import webdriver driver = webdriver.Chrome(executable_path=r'/Users/owner/Desktop/chromedriver') URL = 'https://www.forexfactory.com/news'
from selenium import webdriver
driver = webdriver.Chrome(executable_path=r'/Users/owner/Desktop/chromedriver')
URL = 'https://www.forexfactory.com/news'
driver.get(URL)
driver.implicitly_wait(5) # wait for seconds
uiOuter = driver.find_element_by_id('ui-outer')
aHref = driver.find_elements_by_css_selector('div.flexposts__story-title a')
span = driver.find_elements_by_css_selector('div.flexposts__storydisplay-info')
headline = open("headlines.txt","w+")
for x in aHref:
for y in span:
headline.write(x.text + "\n" + y.text + "\n" + "\n")
错误消息是:
selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist
我不确定这到底意味着什么,当然也不确定该怎么做来修复它。非常感谢您的帮助。
多谢各位