【发布时间】:2020-10-07 02:43:37
【问题描述】:
所以我的代码可以在我的本地机器上运行,在那里我可以抓取并获取所有需要的数据。但是,当尝试在 Amazon linux 服务器上远程运行它时,我遇到了诸如 selenium 找不到元素、selenium.common.exceptions.WebDriverException: Message: chrome not reachable with the options shown below之类的错误。
我曾尝试在某些位置下载 chrome 和 selenium,遵循许多指南说同样的话。
我想知道这是否是兼容性问题。 使用谷歌浏览器 85.0.4183.121 和 ChromeDriver 2.37.544315
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--window-size={}x{}'.format(1280, 1024))
chrome_path = '/home/ec2-user/usr/bin/chromedriver'
#chrome_options.binary_location = '/usr/bin/google-chrome'
driver = webdriver.Chrome(ChromeDriverManager().install(), options=chrome_options)
任何见解将不胜感激,谢谢!
【问题讨论】:
-
你的本地机器也是linux的吗?
-
是的,我用的是mac
-
什么样的linux盒子?可以手动打开chrome吗?
-
我没有 linux 机器。我可以在本地打开 chrome
-
“亚马逊 linux 服务器上的远程”可以在那里打开 chrome 吗?
标签: python-3.x selenium amazon-ec2 selenium-chromedriver amazon-linux