【问题标题】:Watir: Problems trying to get the value of a field that's contained within an iframeWatir:尝试获取 iframe 中包含的字段的值时出现问题
【发布时间】:2023-03-05 18:14:01
【问题描述】:

我正在尝试使用下图所示验证 iframe 中保存的字段中的文本。

当我运行它时,我得到这个语法错误: /opt/homebrew/lib/ruby/gems/3.0.0/gems/watir-6.19.1/lib/watir/elements/element.rb:857:in method_missing': undefined method value' for #<:htmlelement:>"100%", :tag_name=>"iframe"} --> {:id=>"P5533_COMPANY"}> (NoMethodError) 从temporary_exp.rb:83:in `'

如果我使用代码执行“点击”,例如browser.iframe(:width =>"100%").element(id: "P5533_COMPANY").click 然后它工作正常,但由于某种原因它不喜欢“价值”。有什么想法吗?

This is the code I'm running

【问题讨论】:

    标签: iframe watir


    【解决方案1】:

    #value 不是Watir::HTMLElement 对象中的方法,这是您在使用#element 方法时获得的实例。您正在使用的 HTML 元素是复选框吗? (然后使用#checkbox 而不是#element

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多