PhantomJs + Watir:错误消息=> '未定义' (硒:: webdriver的::错误:: UnknownCommandError)

时间:2015-04-16 00:11:27

标签: ruby selenium-webdriver phantomjs watir watir-webdriver

我一直在这里搜索这个问题,但似乎无法找到答案。我正在尝试自动填写表单并使用phantomjs作为浏览器将其提交给watir以使其无头。当我使用firefox运行它时,一切都与我的代码完美配合,但是当我使用phantomJs时,我收到以下错误消息:

/var/lib/gems/1.9.1/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok': Error Message => 'undefined' (Selenium::WebDriver::Error::UnknownCommandError)
     caused by Request => {"headers":{"Accept":"application/json","Connection":"close","Content-Length":"160","Content-Type":"application/json; charset=utf-8","Host":"127.0.0.1:8910","User-Agent":"Ruby"},"httpVersion":"1.1","method":"POST","post":"{\"using\":\"xpath\",\"value\":\".//input[@id='cbxSelectAllPlannedCourses' and translate(@type,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')='checkbox']\"}","url":"/element","urlParsed":{"anchor":"","query":"","file":"element","directory":"/","path":"/element","relative":"/element","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/element","queryKey":{},"chunks":["element"]},"urlOriginal":"/session/d0712620-e3cb-11e4-b75e-e31c63d5c095/element"} (SessionReqHand)
        from /var/lib/gems/1.9.1/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
        from /var/lib/gems/1.9.1/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/remote/http/common.rb:59:in `new'
        from /var/lib/gems/1.9.1/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/remote/http/common.rb:59:in `create_response'
        from /var/lib/gems/1.9.1/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/remote/http/default.rb:66:in `request'
        from /var/lib/gems/1.9.1/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
        from /var/lib/gems/1.9.1/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/remote/bridge.rb:640:in `raw_execute'
        from /var/lib/gems/1.9.1/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/remote/bridge.rb:618:in `execute'
        from /var/lib/gems/1.9.1/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/remote/bridge.rb:586:in `find_element_by'
        from /var/lib/gems/1.9.1/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/common/search_context.rb:42:in `find_element'
        from /var/lib/gems/1.9.1/gems/watir-webdriver-0.7.0/lib/watir-webdriver/locators/element_locator.rb:88:in `find_first_by_multiple'
        from /var/lib/gems/1.9.1/gems/watir-webdriver-0.7.0/lib/watir-webdriver/locators/element_locator.rb:33:in `locate'
        from /var/lib/gems/1.9.1/gems/watir-webdriver-0.7.0/lib/watir-webdriver/elements/element.rb:527:in `locate'
        from /var/lib/gems/1.9.1/gems/watir-webdriver-0.7.0/lib/watir-webdriver/elements/element.rb:504:in `assert_exists'
        from /var/lib/gems/1.9.1/gems/watir-webdriver-0.7.0/lib/watir-webdriver/elements/checkbox.rb:29:in `set?'
        from /var/lib/gems/1.9.1/gems/watir-webdriver-0.7.0/lib/watir-webdriver/elements/checkbox.rb:20:in `set'
        from rabaska.rb:122:in `regrister_cart'
        from rabaska.rb:15:in `main'
        from rabaska.rb:150:in `<main>'

rabaska.rb第122行的代码是:

browser.checkbox(:id => "cbxSelectAllPlannedCourses").set

有什么想法吗?

0 个答案:

没有答案