我知道 google colab 可以用于 selenium 模块,但是在使用 selenium 之前,colab 虚拟机中应该有一个浏览器,所以我使用命令在 colab 中成功安装了 firefox
!apt-get update
!apt install firefox
Run Code Online (Sandbox Code Playgroud)
但是当我尝试使用命令运行 firefox 时
!firefox
Run Code Online (Sandbox Code Playgroud)
它抛出一个错误
src/tcmalloc.cc:283] 尝试释放无效指针 0x7f4e34915040 将对 abort() 的调用重定向到 mozalloc_abort
其他浏览器(例如 Chrome 浏览器和 chrome)也会出现同样的问题。
我什至试过
import webbrowser
webbrowser.get('firefox').open('https://www.youtube.com')
Run Code Online (Sandbox Code Playgroud)
但它抛出一个错误说
找不到浏览器位置
所以总的来说,我需要针对运行浏览器时发生的这个错误的解决方案
尝试释放无效指针 0x7f4e34915040
firefox selenium google-chrome python-webbrowser google-colaboratory