【问题标题】:Error on driving IE using Watir-Webdriver : Unable to find element with xpath使用 Watir-Webdriver 驱动 IE 时出错:无法使用 xpath 找到元素
【发布时间】:2011-11-26 13:27:39
【问题描述】:

我是 Watir-webdriver 的新手。 我曾尝试在 http://bit.ly/watir-example 上使用 Firefox 运行 watir-webdriver

我在 Internet Exploerer(IE 版本 8)上尝试过,但它不起作用。 我还在 IE 上设置了相同值的受保护值。 我的代码很简单:

browser = Watir::Browser.new :ie
browser.goto 'http://bit.ly/watir-example'
sleep 5
browser.text_field(:name => 'entry.0.single').set 'My Name'

我得到的错误信息是这样的:

C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.6.0/lib/selenium/webdriver/remote/response.rb:45:in `assert_ok': 找不到 xpath == 的元素 .//input[(not(@type) 或 (@type!="file" and @type!="radio" and @type!="checkbox" and @type!="submit" 和 @type!="reset" 和 @type!="image" 和 @type!="button" 和 @type!="hidden" 和 @type!="datetime" 和 @type!="date" 和 @type!="month" 和 @type!="week" 和 @type!="time" 和 @type!="datetime-local" 和 @type!="range" 和 @type!="color")) 和@name='entry.0.single'] | .//textarea[@name='entry.0.single'] (Selenium::WebDriver::Error::UnexpectedJavascriptError)

谁能帮帮我? 谢谢。

【问题讨论】:

    标签: watir watir-webdriver


    【解决方案1】:

    使用irb 为您提供有关您的问题的更多信息

    例如。

    > irb
    > require 'watir-webdriver'
    > browser = Watir::Browser.new :ie
    > browser.goto 'http://bit.ly/watir-example'
    > puts browser.title
    > puts browser.text_fields.count
    > browser.text_field.set 'hello'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-06
      • 2018-01-25
      • 1970-01-01
      • 2011-08-14
      • 2021-01-02
      • 2023-03-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多