Cron执行硒时,壁虎驱动程序的路径是什么

问题描述

我正在使用Python进行一些自动化操作 当我使用Selenium和cron时会有一些伤痕 在这种情况下,我使用

硒3.141.0

Python 3.7.3

Mozilla Firefox 68.11.0esr

geckodriver 0.23.0

我已将壁虎驱动程序移至此路径

geckodriver: /usr/local/bin/geckodriver

对于我的python脚本,我使用了它

#!/usr/bin/python
..........omission......
driver = webdriver.Firefox()

并将其保存为 /home/xyz/script.py 而我的路径是

-bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games: No such file or directory

当我通过 ./ script.py 测试脚本时,效果很好。

但是当我使用Cron执行它时出现错误

    Traceback (most recent call last):
  File "/home/xyz/script.py",line 13,in <module>
    driver = webdriver.Firefox()
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/firefox/webdriver.py",line 164,in __init__
    self.service.start()
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/service.py",line 83,in start
    os.path.basename(self.path),self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

Cron的路径有什么问题,我认为文件geckodriver已经在我的路径中。

我应该怎么做。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)