Selenium 远程 Webdriver 60 秒后超时,c# vs2015

问题描述 投票:0回答:2

我面临 selenium Web 驱动程序 c# 的问题。我正在本地计算机上通过 chrome 运行测试,并使用

driver = new Chrome Driver()
启动 chrome 驱动程序。对于其中一个页面,该页面需要超过 60 秒的时间来加载和获取所有元素,并且每次都会显示此消息。

有什么想法吗?我还使用 Visual Studio 2015 和 Nunit。

c# selenium webdriver remotewebdriver
2个回答
0
投票

有一个重载来指定命令超时(默认为 60),但您还必须传入

ChromeOptions
:

https://seleniumhq.github.io/selenium/docs/api/dotnet/html/M_OpenQA_Selenium_Chrome_ChromeDriver__ctor_3.htm

例如:

IWebDriver driver = new ChromeDriver(ChromeDriverService.CreateDefaultService(), new ChromeOptions(), TimeSpan.FromSeconds(120));

0
投票

如果有人在使用 C# Selenium(在 AWS 上)时遇到同样的问题,解决方案是安装 gtk3-devel 包以及来自 https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md 的包#chrome-doesnt-launch-on-linux

© www.soinside.com 2019 - 2024. All rights reserved.