问题描述

通过 Selenium ChromeDriver 无法 find 页面元素但 FriefoxDriver 却是正常的。

大伙可以试试,以这个页面为栗子:- 参考网页

这个页面的元素层级是这样的:

测试 Code:

(我 selenium 版本是 2.45)
目的(打印出这个页面的 Source)或者也可以定位任何一个元素


package com.Test.Version.apps;

import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;



public class test {


    public static  void main(String[]args) throws InterruptedException
    {
        WebDriver driver = null;
        try
          {
            System.setProperty("webdriver.chrome.driver","C:/Users/workspace/chromedriver.exe");
            driver = new ChromeDriver();
            String baseUrl = "http://m.jiuxian.com/m_v1/user/login";
             driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
            driver.get(baseUrl);    
                      //打印Soure
            System.out.println(driver.getPageSource());
          }
        catch(Exception e)
          {
             driver.quit();
          }

    }
}

错误 log:

Starting ChromeDriver (v2.9.248315) on port 12858
[303.808][SEVERE]: Timed out receiving message from renderer: 299.503
[313.810][SEVERE]: Timed out receiving message from renderer: 10.000
timeout: Timed out receiving message from renderer: 10.000
  (Session info: chrome=43.0.2357.130)
  (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 309.99 seconds
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'SH591-PC', ip: '10.200.15.151', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_67'
Session ID: c4373b5abc3743b151a04c1ec28a02bf
Driver info: org.openqa.selenium.chrome.ChromeDriver

nable to receive message from renderer
错误:从渲染器接收消息超时


↙↙↙阅读原文可查看相关链接,并与作者交流