selenium - 如何在谷歌 colab 中运行 chrome webdriver?
问题描述
如何在谷歌 colab 中运行 chrome webdriver?
点安装
- !pip 安装硒
- !apt-获取更新
- !apt 安装铬铬驱动程序
- !cp /usr/lib/chromium-browser/chromedriver /usr/bin
my sample code
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome('chromedriver', options=options)
url = "https://www.instagram.com/"
driver.get(url)
我的照片
当我在 colab 中运行 chrome webdriver 时,
I want to see the execution process with a window.
但是窗户打不开。
我该如何处理?
解决方案
要查看打开的浏览器等,您应该以常规模式运行浏览器,而当前您正在以无头模式运行。
所以,你不必使用options.add_argument('--headless')
推荐阅读
- firebase - 使用多个应用进行 Firebase A/B 测试?
- c++ - 如何使用空字段改进 std::tuple?
- python - 使用 Pandas 根据另一列的数据将列的数据插入另一列
- batch-file - 如何在文件中搜索字符串?
- r - 将范围内的输出列值替换为“真”
- c# - 在 UWP 中使用 StyleSelector 更改扫雷游戏的 ListViewItem 样式
- xamarin - Android Mono 版本或支持包版本
- go - Golang 中的小对象是什么?
- javascript - 使用 Swift 4 在 WKWebView 中查找单击的单词
- python-3.x - 努力使用 PYMC3 实现一个非常基本的(3 个分类变量)贝叶斯网络