mev*_*303 5 python firefox selenium azure-functions
我正在尝试将 Azure Functions 与 Python 结合使用并制定消费计划,以使用 Selenium 和 Firefox 抓取网页。对于它的使用方式,使用消费计划更实用(也更便宜),这意味着我不能使用 Docker 容器。
到目前为止,我已经能够成功地包含和路径 Firefox 的geckodriver二进制文件以及二进制文件。我收到以下错误:
1571952497758 mozrunner::runner INFO Running command: "/home/site/wwwroot/SharedCode/bin/firefox/firefox" "-marionette" "--headless" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofileFyNhwV"
XPCOMGlueLoad error for file /home/site/wwwroot/SharedCode/bin/firefox/libmozgtk.so:
libgtk-3.so.0: cannot open shared object file: No such file or directory
Couldn't load XPCOM.
Run Code Online (Sandbox Code Playgroud)
我的印象是,如果 Firefox/Selenium 在无头模式下运行(它是),则不需要 GTK:
1571952497758 mozrunner::runner INFO Running command: "/home/site/wwwroot/SharedCode/bin/firefox/firefox" "-marionette" "--headless" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofileFyNhwV"
XPCOMGlueLoad error for file /home/site/wwwroot/SharedCode/bin/firefox/libmozgtk.so:
libgtk-3.so.0: cannot open shared object file: No such file or directory
Couldn't load XPCOM.
Run Code Online (Sandbox Code Playgroud)
这可以通过安装 GTK3 来解决。有没有办法apt-get在没有 Docker 的情况下在 Azure Functions 应用程序上安装包?
您将无法在 Azure Functions 上运行 Selenium。它在应用服务容器中运行,这是一个安全的环境,但存在不支持 GDI 或安装包的限制,因为这会使其成为服务器满的而不是无服务器的。因此,如果不使用自定义映像,则不支持 apt-get。
建议放弃消费计划或迁移到低层 BS 系列虚拟机。
底部的此链接显示硒不受支持。
https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox#unsupported-frameworks
| 归档时间: |
|
| 查看次数: |
512 次 |
| 最近记录: |