Php 信息:';chromedriver';在web服务器上执行python selenium时,可执行文件需要位于PATH中
我有一个使用selenium进行抓取的python脚本。在我本地的笔记本电脑上一切都很顺利。 但是当我把这个python文件放在web服务器上时,它总是有关于selenium的错误,现在由于Php 信息:';chromedriver';在web服务器上执行python selenium时,可执行文件需要位于PATH中,php,python,web-services,selenium,webserver,Php,Python,Web Services,Selenium,Webserver,我有一个使用selenium进行抓取的python脚本。在我本地的笔记本电脑上一切都很顺利。 但是当我把这个python文件放在web服务器上时,它总是有关于selenium的错误,现在由于 Traceback (most recent call last): File "test_availability.py", line 32, in <module> driver = webdriver.Chrome(executable_path=CHROMEDRIVER_PA
Traceback (most recent call last):
File "test_availability.py", line 32, in <module>
driver = webdriver.Chrome(executable_path=CHROMEDRIVER_PATH, chrome_options=chrome_options)
File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 68, in __init__
self.service.start()
File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException:
Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
我甚至在Firefox上试过。以下是我使用Firefox的代码:
FIREFOXDRIVER_PATH ="/home/animalsp/public_html/maps/maps2/geckodriver"
WINDOW_SIZE ="1920,1080"
firefox_options = Options()
firefox_options.add_argument("--headless")
firefox_options.add_argument("--window-size=%s" % WINDOW_SIZE)
driver = webdriver.Firefox(executable_path=FIREFOXDRIVER_PATH, firefox_options=firefox_options)
driver.get("https://na.chargepoint.com/charge_point")
有人能帮我吗?
任何回复都将不胜感激
硒3.12.0
python 3.6.5
铬66.0
铬驱动2.3.8
火狐60
壁虎河v0.20.1
您需要将chromedriver可执行文件放在运行脚本的同一目录中,并将chrome\u路径更改为:
import os
chrome_path = os.path.realpath('chromedriver')
您需要将chromedriver可执行文件放在运行脚本的同一目录中,并将chrome\u路径更改为:
import os
chrome_path = os.path.realpath('chromedriver')
鉴于上下文,PHP标记的可能重复似乎不必要。@DebanjanB抱歉,我们有不同的problems@DylanMoore我最后的建议是用php执行python文件,但现在我无法在WebServer中运行我的py文件。鉴于上下文,PHP标记的可能副本似乎没有必要。@DebanjanB抱歉,我们有不同的problems@DylanMoore我的最后一个建议是通过php执行python文件,但现在我无法在Web服务器中运行py文件