【发布时间】:2021-10-18 09:40:14
【问题描述】:
在 gitlab CI 的 docker 中,我正在使用 python selenium 运行一个非常短的测试代码
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument('--start-maximized')
driver = webdriver.Chrome(options=chrome_options)
driver.quit()
但它失败并出现错误
selenium.common.exceptions.WebDriverException: Message: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta type="copyright" content="Copyright (C) 1996-2016 The Squid Software Foundation and contributors">
<meta http-equiv="Content-Type" CONTENT="text/html; charset=utf-8">
<title>ERROR: The requested URL could not be retrieved</title>
<style type="text/css"><!--
/*
* Copyright (C) 1996-2016 The Squid Software Foundation and contributors
....
使用过的包:
- 硒 4.0.0
- chrome浏览器92.0.4515.107
- chromedriver 92.0.4515.43
我可以尝试解决这个问题吗?
提示
尝试获取selenium驱动时出现错误!!
【问题讨论】:
标签: python python-3.x selenium