我安装了selenium和chrome驱动程序。
然后我创建了下面的代码来运行它:
from pyvirtualdisplay import Display
from selenium import webdriver
chromedriver = "/usr/bin/chromedriver"
driver = webdriver.Chrome(chromedriver)
driver.get(url)
html = driver.page_source
driver.quit()
display.stop()
该代码产生以下错误:“”chromedriver.exe“可执行文件必须位于PATH中.请参阅https://sites.google.com/a/chromium.org/chromedriver/home“
路径是正确的。我已经尝试了一些代码的变体,但它们都产生相同的消息。我的webhost声称你不能在安装了cpanel的centos服务器上安装selenium。这是真的吗?还是我的代码有什么问题?
1条答案
按热度按时间toe950271#
您可以使用
OS.environ
和chrome选项