【问题标题】:selenium working as line-by-line but not in a scriptselenium 逐行工作,但不在脚本中
【发布时间】:2020-04-22 20:05:02
【问题描述】:

my python script in upper left corner , error message in the middle , when i execute line by line in the lower left corner, the right half is geckodriver log

m trying to run python script using selenium module to make basic automated youtube search. I get the error show in the middle picture when I write the script as a whole but when I write the code line-by-line it works perfectly . I tried reinstalling gecko and firefox but didnt 工作。 我是如何安装壁虎的:1)un-tar 文件 2)使文件可执行 3)mv 文件到 usr/local/bin ... 壁虎司机 26.0.0 火狐 75.0 Ubuntu 19.10 vim 8.2

【问题讨论】:

  • 您能否提供更多有关 gecko 驱动程序版本和您的 firefox 版本的详细信息?
  • geckodriver 0.26.0 firefox 75.0
  • 那么日志会告诉您问题所在。不支持在常规用户会话中以 root 身份运行 firefox。
  • 我以 sudo 身份运行脚本,因为当我以用户身份运行时,我得到“ PermissionError: [Errno 13] Permission denied: 'geckodriver.log'”

标签: python python-3.x selenium selenium-webdriver geckodriver


【解决方案1】:

日志很清楚错误,你不能运行 geckodriver as root,你必须在不同的用户下运行它,你可以使用sudo -H -u,即:

chown someuser:someuser /path/to/script.py
sudo -H -u someuser python /path/to/script.py

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-18
    • 2021-05-02
    相关资源
    最近更新 更多