私の自動化はすべてwatir-webdriverにあります。私はブラウザをFirefoxとして設定していました。
@profile = Selenium::WebDriver::Firefox::Profile.new
@profile.native_events = false
@client = Selenium::WebDriver::Remote::Http::Default.new
@client.timeout = 300
@b = Watir::Browser.new :firefox, :profile=>@profile, :http_client=>@client
@b.driver.manage.timeouts.implicit_wait = 30
これに切り替えたとき:
@server = Selenium::Server.new("./selenium-server-standalone-2.20.0.jar", :background=>true)
@server.start
@caps = Selenium::WebDriver::Remote::Capabilities.htmlunit(:javascript_enabled=>true)
@client = Selenium::WebDriver::Remote::Http::Default.new
@client.timeout = 300
@b = Watir::Browser.new(:remote, :url=>"http://127.0.0.1:4444/wd/hub", :desired_capabilities=>@caps, :http_client=>@client)
@b.driver.manage.timeouts.implicit_wait = 30
私は最初の非常に単純なタスクに失敗し始めます
@b.link(:text, "Login Again").click
Watir::Exception::UnknownObjectException: unable to locate element, using {:text=>"Login Again", :tag_name=>"a"}
これがなぜであるか、そしてそれについて何ができるかをどうやって理解することができますか?どこから始めたらいいのかわからない。