我知道这个问题有几个答案,但到目前为止我没有任何帮助,所以我发布了一个新问题.
最近我换了电脑,从那时起我不能用硒发射铬.我也试过firefox但浏览器只是没有lanch.
from selenium import webdriver
d = webdriver.Chrome('/home/PycharmProjects/chromedriver')
d.get('https://www.google.nl/')
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /opt/google/chrome/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=2.43.600233, platform=Linux 4.15.0-38-generic x86_64)
Run Code Online (Sandbox Code Playgroud)
我安装了最新的chrome版本和chromedriver
编辑:尝试@ b0sss解决方案后,我收到以下错误.
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed
(chrome not reachable)
(The process started from chrome location /opt/google/chrome/google-chrome is no longer running, so chromedriver is …Run Code Online (Sandbox Code Playgroud) python selenium google-chrome selenium-chromedriver selenium-webdriver
我正在尝试设置一个显示器,但它正在告诉我No such file or directory.
Traceback (most recent call last):
File "/var/www/envs/venv/proj/scripts/my_file.py", line 44, in click
display = Display(visible=0, size=(800,600))
File "/usr/lib/python2.6/site-packages/pyvirtualdisplay/display.py", line 33, in __init__
self._obj = self.display_class(
File "/usr/lib/python2.6/site-packages/pyvirtualdisplay/display.py", line 51, in display_class
cls.check_installed()
File "/usr/lib/python2.6/site-packages/pyvirtualdisplay/xvfb.py", line 38, in check_installed
ubuntu_package=PACKAGE).check_installed()
File "/usr/lib/python2.6/site-packages/easyprocess/__init__.py", line 209, in check_installed
raise EasyProcessCheckInstalledError(self)
easyprocess.EasyProcessCheckInstalledError: cmd=['Xvfb', '-help']
OSError=[Errno 2] No such file or directory
Program install error!
Run Code Online (Sandbox Code Playgroud) 在Chrome昨天发布最新版本(64.0.3282)之后,我现在偶尔会收到此错误:
超时从渲染器接收消息:600.000
我在一个docker容器中运行了大约2,000个selenium测试,我看到这个失败的速度大约是100 in 100.据我所知,没有可重现的步骤 - 每次迭代失败的测试都不同.我更新到最新的Chromedriver(2.35),但这似乎没有任何影响.我之前使用的是Selenium 2.41,但已更新到最新版本(3.8.1),希望它可能有所帮助......它没有.我完全不知道为什么会发生这种情况.有没有其他人注意到这一点?这可能是Chrome最新版本的错误吗?
提前感谢您提供的任何帮助.
当我同时使用参数--headless和user-data-dir. 硒引发selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist异常。如果只使用其中的 1 个,那么一切都会根据需要进行。
我试图交换参数并删除其中一些。指定 chromedriver.exe 的完整路径。这些都没有帮助。
chromeOptions.add_argument("--disable-dev-shm-using") 没有帮助我。
login = "test"
chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_experimental_option("prefs", {"profile.managed_default_content_settings.images": 2})
chromeOptions.add_argument("--no-sandbox")
chromeOptions.add_argument("--disable-setuid-sandbox")
chromeOptions.add_argument("--disable-dev-shm-using")
chromeOptions.add_argument("--disable-extensions")
chromeOptions.add_argument("--disable-gpu")
chromeOptions.add_argument("start-maximized")
chromeOptions.add_argument("disable-infobars")
chromeOptions.add_argument("--headless")
chromeOptions.add_argument(r"user-data-dir=.\cookies\\" + login)
b = webdriver.Chrome(chrome_options=chromeOptions)
b.get("https://google.com/")
b.quit()
Run Code Online (Sandbox Code Playgroud) 我也有一个带有 UI 的 ubuntu 服务器。你可以通过触发 mvn test 命令来执行测试用例。但问题是当我从另一台机器通过终端对机器执行 ssh 时,我收到以下错误 -
unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.4.0-121-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.04 seconds
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: 'ubuntu-test', ip: 'X.X.X.X', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-121-generic', java.version: '1.8.0_171'
Driver info: driver.version: ChromeDriver
Run Code Online (Sandbox Code Playgroud)
但是,如果我通过 remmina 远程控制机器,然后执行该机器终端的相同命令,则相同的命令会成功启动 chrome。
linux selenium google-chrome selenium-chromedriver selenium-webdriver
建立:
在heroku中使用selenium时出现此错误:
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
Run Code Online (Sandbox Code Playgroud)
我用Google搜索但没有运气.错误发生在此代码的最后一行.
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
UA = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36' \
'(KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'
DRIVER_PATH = '/app/.chromedriver/bin/chromedriver'
chrome_options = webdriver.ChromeOptions()
chrome_options.binary_location = '/app/.apt/usr/bin/google-chrome'
chrome_options.add_argument(f'--user-agent={UA}')
chrome_options.add_argument(f'--proxy-server=http://my_private_proxy.com:my_port')
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument('--no-sandbox')
chrome = webdriver.Chrome(executable_path=DRIVER_PATH, options=options)
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用chromedriver 2.10在Chrome浏览器版本35.0.1916.114上运行我的测试在CentOS机器上
/home/varunm/EC_WTF_0.4.10/EC_WTF0.4.10_Project/wtframework/wtf/drivers/chromedriver
实际上我修复了路径问题,因为如果问题是路径,则错误消息不同
def start(self):
"""
Starts the ChromeDriver Service.
:Exceptions:
- WebDriverException : Raised either when it can't start the service
or when it can't connect to the service
"""
env = self.env or os.environ
try:
self.process = subprocess.Popen([
self.path,
"--port=%d" % self.port] +
self.service_args, env=env, stdout=PIPE, stderr=PIPE)
except:
raise WebDriverException(
"ChromeDriver executable needs to be available in the path. \
Please download from http://chromedriver.storage.googleapis.com/index.html\
and read up at http://code.google.com/p/selenium/wiki/ChromeDriver")
count = 0
while not utils.is_connectable(self.port):
count += …Run Code Online (Sandbox Code Playgroud) 我想通过铬运行硒。我写了这段代码:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("start-maximized")
options.add_argument("disable-infobars")
options.add_argument("--disable-extensions")
options.add_argument("--disable-gpu")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--no-sandbox")
options.binary_location = "/snap/bin/chromium"
driver = webdriver.Chrome(chrome_options=options)
Run Code Online (Sandbox Code Playgroud)
但这段代码会抛出一个错误:
selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist
Stacktrace:
#0 0x55efd7355a23 <unknown>
#1 0x55efd6e20e18 <unknown>
#2 0x55efd6e46e12 <unknown>
Run Code Online (Sandbox Code Playgroud)
正确版本的 chromedriver 位于 usr/bin 中。我究竟做错了什么?
python chromium selenium-chromedriver selenium-webdriver selenium-webdriver-python
我开始研究 Selenium (C#),令我惊讶的是,我什至无法运行Selenium Docs中最简单的项目。然而,我的同事开箱后就可以正常运行,没有任何问题。
我能够运行的唯一方法是将--no-sandbox选项添加到 Chrome 选项中。Firefox (Gekco) 驱动程序没有这个问题,并且我的 Chrome 版本和我的 Chromedriver 版本匹配。但我不能对每个项目都这样做,因为我们使用的库不通过此选项,并且它超出了我的控制范围。
我可能需要更改哪些策略/配置?
我试图在 S/O 上找到其他类似的线程,但没有一个能解决我的问题。大多数问题可以通过更新 Chrome/ChromeDriver 版本来解决,但我的是最新的 100(Chrome 99 也有同样的问题)。
它只是停留在data:,并且不会继续到任何其他页面。
Starting ChromeDriver 100.0.4896.60 (6a5d10861ce8de5fce22564658033b43cb7de047-refs/branch-heads/4896@{#875}) on port 61538
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
DevTools listening on ws://127.0.0.1:61542/devtools/browser/38c3268c-dd43-4100-bb1a-71aa2af4c1fc
Unhandled exception. OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:61538/session timed out after 60 seconds.
---> System.Threading.Tasks.TaskCanceledException: …Run Code Online (Sandbox Code Playgroud) c# selenium google-chrome selenium-chromedriver selenium-webdriver
Chrome 在我的 Jenkins 上不稳定。当我运行 build 5 次时,它运行 1 - 2 次成功,另外 3 次出现上述错误。
Chrome 代码:
ChromeOptions options = new ChromeOptions();
System.setProperty("webdriver.chrome.driver","/usr/local/bin/chromedriver");
options.addArguments("--headless");
options.addArguments("--no-sandbox");
options.addArguments("--disable-dev-shm-usage");
driver = new ChromeDriver(options);
driver.get("https://mywebsite.com");
Run Code Online (Sandbox Code Playgroud)
我已经采取了一些步骤: