简体   繁体   中英

Selenium Chromedriver not working in Python, Centos Cpanel Server

I installed selenium and chrome driver.

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 "

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. Is this true or is there something wrong with my code?

you might use OS.environ and chromeoptions

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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