Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在AWS EC2 linux中运行selenium webdriver_Python_Linux_Amazon Web Services_Selenium_Amazon Ec2 - Fatal编程技术网

Python 在AWS EC2 linux中运行selenium webdriver

Python 在AWS EC2 linux中运行selenium webdriver,python,linux,amazon-web-services,selenium,amazon-ec2,Python,Linux,Amazon Web Services,Selenium,Amazon Ec2,我在AmazonLinuxAMI上安装了selenium。我尝试使用python来激活它。 错误出现了。我不知道这是什么意思。chrome webdriver可以在该环境下运行 我的代码 from selenium import webdriver driver = webdriver.Chrome("/home/ec2-user/dlfjj/bin/chromedriver") 错误 回溯(最近一次呼叫最后一次): 文件“”,第1行,在 文件“/home/ec2 user/dlfjj/loc

我在AmazonLinuxAMI上安装了selenium。我尝试使用python来激活它。 错误出现了。我不知道这是什么意思。chrome webdriver可以在该环境下运行

我的代码

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

回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/home/ec2 user/dlfjj/local/lib/python2.7/site packages/selenium/webdriver/chrome/webdriver.py”,第62行,在__
self.service.start()
文件“/home/ec2 user/dlfjj/local/lib/python2.7/site packages/selenium/webdriver/common/service.py”,第86行,开头
os.path.basename(self.path)、self.start\u错误消息)
selenium.common.exceptions.WebDriverException:消息:“chromedriver”可执行文件可能具有错误的权限。请看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
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/home/ec2 user/dlfjj/local/lib/python2.7/site packages/selenium/webdriver/chrome/webdriver.py”,第62行,在__
self.service.start()
文件“/home/ec2 user/dlfjj/local/lib/python2.7/site packages/selenium/webdriver/common/service.py”,第96行,开头
self.assert\u进程\u仍在运行()
文件“/home/ec2 user/dlfjj/local/lib/python2.7/site packages/selenium/webdriver/common/service.py”,第109行,断言进程仍在运行
%(self.path,返回\u代码)
selenium.common.exceptions.WebDriverException:消息:Service/home/ec2 user/dlfjj/bin/chromedriver意外退出。状态代码为:127
错误状态为

'chromedriver' executable may have wrong permissions
。。。这意味着它无法执行。如果在EC2实例中添加execute位,它应该可以工作

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