使用PhantomJS驱动程序时,Selenium WebDriver上的sendKeys()方法无效

时间:2016-07-04 08:57:28

标签: java selenium-webdriver phantomjs

今年早些时候,我为团队QA创建了WebDriver测试框架,它通过多个表单运行,使用FirefoxDriver or PhantomJSDriver填写表单的不同流程。直到最近在PhantomJS中运行时,它运行良好,现在无法运行并通过此错误:

  

RouterReqHand --_handle.error - {“line”:264,“sourceURL”:“phantomjs://code/webelement_request_handler.js”,“stack”:“_ posttValueCommand @ phantomjs://code/webelement_request_handler.js:264 :52 \ n_handle @ phantomjs://code/webelement_request_handler.js:72:30 \ n_reroute @ phantomjs://code/request_handler.js:61:20 \ n_handle @ phantomjs://code/session_request_handler.js:120:42 \ n_reroute @ phantomjs://code/request_handler.js:61:20 \ n_handle @ phantomjs://code/router_request_handler.js:78:46" }

     

phantomjs://platform/console++.js:263错误   org.openqa.selenium.UnsupportedCommandException:TypeError - undefined不是构造函数(评估'_getTagName(currWindow).toLowerCase()')   命令持续时间或超时:7毫秒   建立信息:版本:'2.53.0',修订版:'35ae25b1534ae328c771e0856c93e187490ca824',时间:'2016-03-15 10:43:46'   系统信息:主机:'Andrew's-MacBook-Pro.local',ip:'172.16.0.82',os.name:'Mac OS X',os.arch:'x86_64',os.version:'10 .11.5' ,java.version:'1.8.0_65'   驱动程序信息:org.openqa.selenium.phantomjs.PhantomJSDriver   Capabilities [{applicationCacheEnabled = false,rotate = false,handlesAlerts = false,databaseEnabled = false,version = 2.1.1,platform = OS X 10.11,browserConnectionEnabled = false,proxy = {proxyType = direct},nativeEvents = true,acceptSslCerts = false ,driverVersion = 1.2.0,locationContextEnabled = false,webStorageEnabled = false,browserName = phantomjs,takesScreenshot = true,driverName = ghostdriver,javascriptEnabled = true,cssSelectorsEnabled = true}]   会议ID:c5370630-41c1-11e6-810d-b97a0e25b39f

查看堆栈跟踪我已经看到这是在调用sendKeys()方法时引起的,正如我所提到的那样它在PhantomJS中几个月没有变化,但是现在它只适用于Firefox。任何帮助都会有很大的帮助。

我的maven依赖项(如果有帮助)是

<dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.9.10</version>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.53.0</version>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-server</artifactId>
        <version>2.53.0</version>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-firefox-driver</artifactId>
        <version>2.53.0</version>
    </dependency>

    <dependency>
        <groupId>com.codeborne</groupId>
        <artifactId>phantomjsdriver</artifactId>
        <version>1.3.0</version>
    </dependency>

0 个答案:

没有答案