简体   繁体   English

Selenium Chromedriver 在 Python、Centos Cpanel 服务器中不工作

[英]Selenium Chromedriver not working in Python, Centos Cpanel Server

I installed selenium and chrome driver.我安装了 selenium 和 chrome 驱动程序。

I then created the below code to run it:然后我创建了以下代码来运行它:

 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()

The code yields the following error: "'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home "代码产生以下错误:“'chromedriver.exe' 可执行文件需要在 PATH 中。请参阅https://sites.google.com/a/chromium.org/chromedriver/home

The path is correct.路径是正确的。 I have tried some variations of the code but they all yield the same message.我尝试了一些代码变体,但它们都产生相同的消息。 My webhost claims you cant install selenium on a centos server that has cpanel.我的虚拟主机声称您无法在具有 cpanel 的 centos 服务器上安装 selenium。 Is this true or is there something wrong with my code?这是真的还是我的代码有问题?

you might use OS.environ and chromeoptions你可能会使用OS.environ和 chromeoptions

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM