Hello team,
I am trying to login to a server using *watir-webdriver. *The final
objective is to scrape the screen and get certain information from it.
I started first by trying to login.
I am able to get the browser and fill in the USERID & PASSWORD to te
login
screen. However, I am having a hard time pressing the OK button in
order
to proceed to the main screen.
I tried all kinds of combinations and nothing worked so far.
The simple ruby code is listed below.
================================================
require ‘watir-webdriver’
b = Watir::Browser.new :firefox
b.goto “http://thehost/cognos8/cgi-bin/cognos.cgi
http://thehost/cognos8/cgi-bin/cognos.cgi”
b.text_field(:name => ‘CAMUsername’).set(“test”)
b.text_field(:name => ‘CAMPassword’).set(“test”)
b.button(:value => ‘OK’).click
puts b.url
b.close
I am getting the following errors:
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/watir-webdriver-0.6.8/lib/watir-webdriver/elements/element.rb:490:in
`assert_exists’: unable to locate element, using {:name=>“ok”,
:tag_name=>“button”} (Watir::Exception::UnknownObjectException)
-
from
/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/watir-webdriver-0.6.8/lib/watir-webdriver/elements/element.rb:118:in
`click’*
-
from checkPendingU1.rb:7:in `<main>'*
================================================
One last thing, I am also including what appears to be html code which I
got by running Inspector on firefox.
“Inspeting the element” in the JavaScript/html? code the following
appears
to be the code handling the OK button. But I don’t know what variable
to
use to click the button.
Thank you
Ruby S.