python - Selenium Python 在 Google Colab 中不起作用
问题描述
我在 google colab 上使用了以下代码并安装了 selenium 包
# !pip install selenium
# !apt-get update # to update ubuntu to correctly run apt install
# !apt install chromium-chromedriver
# !cp /usr/lib/chromium-browser/chromedriver /usr/bin
import sys
sys.path.insert(0,'/usr/lib/chromium-browser/chromedriver')
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
wd = webdriver.Chrome('chromedriver',chrome_options=chrome_options)
wd.get("https://pooya.um.ac.ir/gateway/PuyaAuthenticate.php")
只是加载了一段时间,根本不工作..!! 我怎样才能修复它以访问任何网站?
解决方案
推荐阅读
- cron - 会错过 shebang 停止脚本运行
- android - 更改组合图表图例顺序,MPAndroidChart
- jestjs - 所有测试都通过了 100% 的覆盖率,但 jest 返回退出代码 1
- angular - 将PNG作为图标
- java - 如何指定一次使用哪个模式?
- coq - Current required number of arguments for unfolding by `simpl`
- haskell - What do you use for base case for Int -> Int -> [Int] in haskell?
- html - How to add a line as a pseudo element when using flex-box
- scala - Move files between hdfs directories as aprt of spark scala application
- unit-testing - 业力日志级别值