python - Google App Engine 上的 Selenium webdriver chrome
问题描述
我可以找到很多类似的主题,但没有一个有帮助......我已经在 GAE 上成功安装了 chromedriver,但我不断得到以下内容。
WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
start (/env/lib/python3.7/site-packages/selenium/webdriver/common/service.py:83)
我的python代码。
try:
if 'linux' in sys.platform:
print("Headless Chrome Initialized on Linux")
return webdriver.Chrome()
except WebDriverException as e:
print(getattr(e, 'message', repr(e)))
print(getattr(e, 'message', str(e)))
我可以从服务器的命令行启动 chromedriver ...
Starting ChromeDriver 77.0.3865.40 (f484704e052e0b556f8030b65b953dce96503217-refs/branch-heads/3865@{#442}) on port 9515
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
还尝试使用可执行路径 /usr/bin/chromedriver 但结果相同...
webdriver.Chrome(executable_path='/usr/bin/chromedriver')
解决方案
推荐阅读
- c# - 构建解决方案时,由于元数据错误,ccrewrite 失败,重写中止 -> 无法解析类型引用,仅在我的机器上失败
- mongodb - 从 apache 服务器到 mongodb 的反向代理
- r - 如何使用 R 为没有数据点的列插入占位符?
- django - Django CMS 中自定义菜单的顺序
- jquery - 在特定月份打开 jquery datepicker
- ios - 如何从自定义 UIView 调用 UIViewController 内的方法/动作?
- angular - 如何在角度 5 中固定命令行
- r - 如何使用 echarts4r 在日历中自动分隔年份
- java - 我们可以在 ARCore 应用程序中突出显示所有检测到的平面吗?
- ios - 如何在 IOS Apps Swift 中处理强制关闭