This is your problem -- Unable to locate element, using :id, "c_ddlCategory"

Make sure you have this element visible and enable.

Your Html code did not show this element, only login which is fine you said.



----- Original Message ----
From: Mark Lehky <mark.le...@aclaro.com>
To: watir-general@googlegroups.com
Sent: Tuesday, March 17, 2009 8:05:47 AM
Subject: [wtr-general] Problems locating basic elements in Watir


Hello all.

I am new to Watir as well as Ruby, but have had experience with other
tools and languages. Installed Ruby+Watir (no issues), ran through the
basic tutorial, everything worked just fine.

I then tried to create the first test for my AUT. The test was quite
simple: login and try to locate some text on the next page.
The login portion worked: found the two text boxes
(username/password), found the login button. However, the next page is
effectively blank to Watir. For any element that I tried to .flash, I
always got the error:
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:52:in
`assert_exists': Unable to locate element, using :id, "c_ddlCategory"
(Watir::Exception::UnknownObjectException)
    from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:239:in
`flash'
    from petroLook_login.rb:15

After searching through past posts here, I was led to Webmetrics RIA
Script Recorder. That tool cannot "see" of the elements either -
nothing is recorded after the login page. :(

Here is my sample Watir test:
require "watir"
test_site = "http://localhost/petroLook4410";
ie = Watir::IE.new
ie.goto test_site
if ! ie.text.include? "Login"
  puts "Test Failed! Could not find: 'Login'."
  exit 1
end
ie.text_field(:id, "c__txtUsername").set "bootstrap"
ie.text_field(:id, "c__txtPassword").set "bootstrap"
ie.button(:id, "c__btnLogin").click
# everything past this point is "gone"
if ! ie.text.include? "Activating the database"
  puts "Test Failed! Could not find: 'Activating the database'."
  exit 1
end
puts "All good!"
exit 0

Here is the HTML code snippet grabbed from IE Developer Toolbar of the
above text (I wonder how e-mail clients are going to handle this - I
am typing this in plaintext-mode):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML Transitional//EN">
<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
<HTML class=" page" id="html">
<HEAD>
<STYLE> /* No matching styles were found. */ </STYLE>
</HEAD>
<BODY class=" page ie" id="body">
  <FORM id="frmControlHost" name="frmControlHost"
action="WebPages_ControlHost.aspx?control=aclaro.petroLook.WebControls.Generic.PageHost&pagetype=Admin&category=Bootstrap&group=Schema"
method="post">
   <P>Activating the database enables petroLook users to log in and
disables the bootstrap user. </P>
  </FORM>
</BODY>
</HTML>

TIA for any help.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to