Watir web driver"无法定位元素"

时间:2014-11-06 21:51:26

标签: webdriver watir

我有以下代码可以在Windows机器上正常工作,但是当使用TextMate工具从MAC尝试时,我收到此错误:

hello.rb:2: warning: class variable access from toplevel
hello.rb:3: warning: class variable access from toplevel
hello.rb:6: warning: class variable access from toplevel
hello.rb:9: warning: class variable access from toplevel
hello.rb:10: warning: class variable access from toplevel
hello.rb:13: warning: class variable access from toplevel
hello.rb:16: warning: class variable access from toplevel
Watir::Exception::UnknownObjectException: unable to locate element, using
{:name=>"LeagueName", :tag_name=>"input or textarea", :type=>"(any text type)"}

method assert_exists    in element.rb at line 513
method set  in user_editable.rb at line 11
method <main>   in hello.rb at line 16

产生此错误的代码如下:

require 'watir-webdriver'
@@browser = Watir::Browser.new(:safari)
@@browser.goto("www.leagueplanit.com/demo")

@@pLeagueName = "Automation"

@@browser.link(:text=>"Add New League").click
@@browser.link(:href=>"http://www.leagueplanit.com/demo/league/add").click
#--CREATE LEAGUE
def mleaguename_txt 
@@browser.text_field(:name=>"LeagueName")
end

mleaguename_txt.set @@pLeagueName

非常感谢任何帮助。

0 个答案:

没有答案