【问题标题】:Running selenium webdriver in AWS EC2 linux在 AWS EC2 linux 中运行 selenium webdriver
【发布时间】:2018-01-13 14:54:50
【问题描述】:

我在 Amazon Linux AMI 上安装了 selenium。我尝试使用 python 来激活它。 错误出现。我不知道应该是什么意思。 chrome webdriver 可以在那个环境下运行吗?

我的代码

from selenium import webdriver
driver = webdriver.Chrome("/home/ec2-user/dlfjj/bin/chromedriver")

错误

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ec2-user/dlfjj/local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 62, in __init__
self.service.start()
  File "/home/ec2-user/dlfjj/local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 86, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home` 

更新: 出现新错误。

 Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ec2-user/dlfjj/local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 62, in __init__
    self.service.start()
  File "/home/ec2-user/dlfjj/local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 96, in start
    self.assert_process_still_running()
  File "/home/ec2-user/dlfjj/local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 109, in assert_process_still_running
    % (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service /home/ec2-user/dlfjj/bin/chromedriver unexpectedly exited. Status code was: 127

【问题讨论】:

    标签: python linux amazon-web-services selenium amazon-ec2


    【解决方案1】:

    错误状态...

    'chromedriver' executable may have wrong permissions
    

    ... 表示无法执行。如果您在 EC2 实例中添加执行位,它应该可以工作

    $ chmod +x /home/ec2-user/dlfjj/bin/chromedriver
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-29
      • 1970-01-01
      • 1970-01-01
      • 2020-06-19
      • 1970-01-01
      • 2018-01-25
      相关资源
      最近更新 更多