我正在尝试使用下面的方法打开Url。但是加载Url需要花费很长时间,但是它是测试环境Url。
@BeforeClass
public void setup() {
System.setProperty("webdriver.chrome.driver","C:\\chromedriver_win32\\chromedriver.exe");
driver = new ChromeDriver();
driver.get("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS);
}
使用driver.get("XXXXXX")
方法加载网址大约需要4分钟,这会在下面引发异常
启动ChromeDriver 73.0.3683.68 端口6967上的(47787ec04b6e38e22703e856e101e840b65afe72)仅本地 允许连接。请保护ChromeDriver和 相关的测试框架,以防止被恶意代码访问。 4月20日, 2019 3:59:52 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO:检测到的方言:OSS [1555756492.787] [SEVERE]: 超时从渲染器接收消息:298.674 [1555756492.795] [SEVERE]:超时从渲染器接收消息: -0.008失败的配置:@BeforeClass设置org.openqa.selenium.TimeoutException:超时(会话信息: chrome = 73.0.3683.103)(驱动程序信息:chromedriver = 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),平台= Windows NT 6.1.7601 SP1 x86)(警告:服务器未提供任何堆栈跟踪信息)命令持续时间或超时:300.02秒构建信息: 版本:“未知”,修订版:“未知”,时间:“未知”系统信息: 主机:'ADMIN-PC',ip:'192.168.1.6',操作系统名称:'Windows 7',os.arch: 'x86',os.version:'6.1',java.version:'1.8.0_121'驱动程序信息: org.openqa.selenium.chrome.ChromeDriver功能 [{mobileEmulationEnabled = false,超时= {隐式= 0.0, pageLoad = 300000.0,脚本= 30000.0},hasTouchScreen = false,平台= XP, acceptSslCerts = false, goog:chromeOptions = {debuggerAddress = localhost:51331}, acceptInsecureCerts = false,webStorageEnabled = true,browserName = chrome, TakesScreenshot = true,javascriptEnabled = true,setWindowRect = true, SurpriseAlertBehaviour =忽略,applicationCacheEnabled = false, rotatable = false,networkConnectionEnabled = false, chrome = {chromedriverVersion = 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72), userDataDir = C:\ Users \ admin \ AppData \ Local \ Temp \ scoped_dir2592_17813}, takeHeapSnapshot = true,pageLoadStrategy = normal, strictFileInteractability = false,databaseEnabled = false, handlesAlerts = true,版本= 73.0.3683.103, browserConnectionEnabled = false,proxy = Proxy(),nativeEvents = true, locationContextEnabled = true,cssSelectorsEnabled = true}]会话ID: f2e4b8e52414566b01dff2c0ba9f7ce4
答案 0 :(得分:-1)
此错误消息...
INFO: Detected dialect: OSS
[1555756492.787][SEVERE]: Timed out receiving message from renderer: 298.674
[1555756492.795][SEVERE]: Timed out receiving message from renderer: -0.008
FAILED CONFIGURATION: @BeforeClass setup org.openqa.selenium.TimeoutException: timeout
(Session info: chrome=73.0.3683.103)
(Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Windows NT 6.1.7601 SP1 x86) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 300.02 seconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'ADMIN-PC', ip: '192.168.1.6', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_121'
...表示 ChromeDriver 无法启动/产生新的 Web浏览会话,即 Chrome浏览器会话。
您的主要问题是所使用的二进制版本之间的不兼容性:
因此 ChromeDriver v73.0.3683.68 , Chrome v73.0.3683.103 和 JDK v8u121 之间显然存在不匹配。 / p>
将 JDK 升级到最新级别JDK 8u202。