[wtr-general] Re: Problems locating basic elements in Watir
Hey thanx! These work perfect. M. 2009/3/17 marekj : > I see the wild guess worked. > Each document in a frame is probably a separate DOM and I presume the > framesets were built as a view so each frame could be refreshed > independently. > Now you may want to build a map of frames but don't do assignment like this > frame = ie.frame(how, what) > because if the page refreshes inside the frame your frame variable holds > reference to a stale object which does not exist > > to make sure you always have access to the latest DOM in frames I would > build some methods: > like so: > > def browser > @ie # or any other browser > end > > def content > frame(:id, 'contentFrame') > end > > def top > frame(:id, 'frameTop') > end > > now you can access your DOM in a frame > browser.content.top.element > browser.content.element > > you decide the semantic method names you want to give to frames > you make small method wrappers for your watir code. > it helps you clarify what frame is what. > > (I am sorry but Watirloo is still not intuitive enough to recommend it but I > am working on it) > marekj > > Watirloo: Semantic Page Objects in UseCases > http://github.com/marekj/watirloo/ > > > > On Tue, Mar 17, 2009 at 3:39 PM, Mark Lehky wrote: >> >> For anyone following this thread: >> Yes, you can traverse the frames as I indicated below, and it works! :D >> >> Now, can I do the same using XPath ... >> >> >> 2009/3/17 Mark Lehky : >> > I think the answer is somewhere in your suggestion. >> > The element(s) that I am looking for is quite deep in several nested >> > FRAMESET/FRAME/FRAMESET/FRAME/... >> > Is there a way in Watir/Ruby to say "in any frame, no matter how deep"? >> > If not, how do I traverse them? Can I do something like: >> > ie = Watir::IE.new >> > frame1 = ie.frame(:id, "contentFrame") >> > frame2 = frame1.frame(:id, "frameTop") >> > ...etc. >> > >> > Thank You all for the help so far. >> >> > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[wtr-general] Re: Problems locating basic elements in Watir
Just wondering if my guess was correct: does XPath infact not work with frames in Watir? TIA. 2009/3/17 Mark Lehky : > Here is a better wiki link http://wiki.openqa.org/display/WTR/XPath > Apparently it does not work: > > In my case, this works fine: > level1 = ie.frame(:id, "contentFrame") > level2 = level1.frame(:id, "frameHeader") > myselect = level2.select_list(:id, "c_ddlCategory") > myselect.flash > > This does NOT work: > myselect2 = ie.select_list(:xpath, "//sele...@id='c_ddlCategory']") > myselect2.flash > >> Unable to locate element, using :xpath > > This also does NOT work: > myselect2 = level2.select_list(:xpath, "//sele...@id='c_ddlCategory']") > myselect2.flash > >> undefined method `element_by_xpath' > > :( > > > 2009/3/17 Mark Lehky : >> With respect to XPath, the best I have been able to Google so far is >> this document: >> http://svn.openqa.org/fisheye/browse/~raw,r=897/watir/trunk/watir/doc/Support%20for%20XPATH%20in%20Watir.doc >> which suggests that XPath in Watir is supported _except_ for FRAMES? >> Is this still the case? >> >> TIA. >> >> >> 2009/3/17 Mark Lehky : >>> For anyone following this thread: >>> Yes, you can traverse the frames as I indicated below, and it works! :D >>> >>> Now, can I do the same using XPath ... >>> >>> >>> 2009/3/17 Mark Lehky : I think the answer is somewhere in your suggestion. The element(s) that I am looking for is quite deep in several nested FRAMESET/FRAME/FRAMESET/FRAME/... Is there a way in Watir/Ruby to say "in any frame, no matter how deep"? If not, how do I traverse them? Can I do something like: ie = Watir::IE.new frame1 = ie.frame(:id, "contentFrame") frame2 = frame1.frame(:id, "frameTop") ...etc. Thank You all for the help so far. >>> >> > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[wtr-general] Re: Problems locating basic elements in Watir
Here is a better wiki link http://wiki.openqa.org/display/WTR/XPath Apparently it does not work: In my case, this works fine: level1 = ie.frame(:id, "contentFrame") level2 = level1.frame(:id, "frameHeader") myselect = level2.select_list(:id, "c_ddlCategory") myselect.flash This does NOT work: myselect2 = ie.select_list(:xpath, "//sele...@id='c_ddlCategory']") myselect2.flash > Unable to locate element, using :xpath This also does NOT work: myselect2 = level2.select_list(:xpath, "//sele...@id='c_ddlCategory']") myselect2.flash > undefined method `element_by_xpath' :( 2009/3/17 Mark Lehky : > With respect to XPath, the best I have been able to Google so far is > this document: > http://svn.openqa.org/fisheye/browse/~raw,r=897/watir/trunk/watir/doc/Support%20for%20XPATH%20in%20Watir.doc > which suggests that XPath in Watir is supported _except_ for FRAMES? > Is this still the case? > > TIA. > > > 2009/3/17 Mark Lehky : >> For anyone following this thread: >> Yes, you can traverse the frames as I indicated below, and it works! :D >> >> Now, can I do the same using XPath ... >> >> >> 2009/3/17 Mark Lehky : >>> I think the answer is somewhere in your suggestion. >>> The element(s) that I am looking for is quite deep in several nested >>> FRAMESET/FRAME/FRAMESET/FRAME/... >>> Is there a way in Watir/Ruby to say "in any frame, no matter how deep"? >>> If not, how do I traverse them? Can I do something like: >>> ie = Watir::IE.new >>> frame1 = ie.frame(:id, "contentFrame") >>> frame2 = frame1.frame(:id, "frameTop") >>> ...etc. >>> >>> Thank You all for the help so far. >> > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[wtr-general] Re: Problems locating basic elements in Watir
With respect to XPath, the best I have been able to Google so far is this document: http://svn.openqa.org/fisheye/browse/~raw,r=897/watir/trunk/watir/doc/Support%20for%20XPATH%20in%20Watir.doc which suggests that XPath in Watir is supported _except_ for FRAMES? Is this still the case? TIA. 2009/3/17 Mark Lehky : > For anyone following this thread: > Yes, you can traverse the frames as I indicated below, and it works! :D > > Now, can I do the same using XPath ... > > > 2009/3/17 Mark Lehky : >> I think the answer is somewhere in your suggestion. >> The element(s) that I am looking for is quite deep in several nested >> FRAMESET/FRAME/FRAMESET/FRAME/... >> Is there a way in Watir/Ruby to say "in any frame, no matter how deep"? >> If not, how do I traverse them? Can I do something like: >> ie = Watir::IE.new >> frame1 = ie.frame(:id, "contentFrame") >> frame2 = frame1.frame(:id, "frameTop") >> ...etc. >> >> Thank You all for the help so far. > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[wtr-general] Re: Problems locating basic elements in Watir
I see the wild guess worked. Each document in a frame is probably a separate DOM and I presume the framesets were built as a view so each frame could be refreshed independently. Now you may want to build a map of frames but don't do assignment like this frame = ie.frame(how, what) because if the page refreshes inside the frame your frame variable holds reference to a stale object which does not exist to make sure you always have access to the latest DOM in frames I would build some methods: like so: def browser @ie # or any other browser end def content frame(:id, 'contentFrame') end def top frame(:id, 'frameTop') end now you can access your DOM in a frame browser.content.top.element browser.content.element you decide the semantic method names you want to give to frames you make small method wrappers for your watir code. it helps you clarify what frame is what. (I am sorry but Watirloo is still not intuitive enough to recommend it but I am working on it) marekj Watirloo: Semantic Page Objects in UseCases http://github.com/marekj/watirloo/ On Tue, Mar 17, 2009 at 3:39 PM, Mark Lehky wrote: > > For anyone following this thread: > Yes, you can traverse the frames as I indicated below, and it works! :D > > Now, can I do the same using XPath ... > > > 2009/3/17 Mark Lehky : > > I think the answer is somewhere in your suggestion. > > The element(s) that I am looking for is quite deep in several nested > > FRAMESET/FRAME/FRAMESET/FRAME/... > > Is there a way in Watir/Ruby to say "in any frame, no matter how deep"? > > If not, how do I traverse them? Can I do something like: > > ie = Watir::IE.new > > frame1 = ie.frame(:id, "contentFrame") > > frame2 = frame1.frame(:id, "frameTop") > > ...etc. > > > > Thank You all for the help so far. > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[wtr-general] Re: Problems locating basic elements in Watir
For anyone following this thread: Yes, you can traverse the frames as I indicated below, and it works! :D Now, can I do the same using XPath ... 2009/3/17 Mark Lehky : > I think the answer is somewhere in your suggestion. > The element(s) that I am looking for is quite deep in several nested > FRAMESET/FRAME/FRAMESET/FRAME/... > Is there a way in Watir/Ruby to say "in any frame, no matter how deep"? > If not, how do I traverse them? Can I do something like: > ie = Watir::IE.new > frame1 = ie.frame(:id, "contentFrame") > frame2 = frame1.frame(:id, "frameTop") > ...etc. > > Thank You all for the help so far. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[wtr-general] Re: Problems locating basic elements in Watir
I think the answer is somewhere in your suggestion. The element(s) that I am looking for is quite deep in several nested FRAMESET/FRAME/FRAMESET/FRAME/... Is there a way in Watir/Ruby to say "in any frame, no matter how deep"? If not, how do I traverse them? Can I do something like: ie = Watir::IE.new frame1 = ie.frame(:id, "contentFrame") frame2 = frame1.frame(:id, "frameTop") ...etc. Thank You all for the help so far. 2009/3/17 Michael Hwee : > > > So, you might want to try: > $ie.frame(:index,1).text.include?("Activating the database") > > > > > - Original Message > From: Mark Lehky > To: watir-general@googlegroups.com > Sent: Tuesday, March 17, 2009 10:20:03 AM > Subject: [wtr-general] Re: Problems locating basic elements in Watir > > > The puts ie.html.inspect generates: > > > petroLook - aclaro softworks, inc.\r\n > > > > src=\"/petroLook4410/plugins/cache/webresources/aclaro_petroLook_WebResources/4_4_3353_10382/WebPages_Administration_AdministrationFrameset.aspx?category=Bootstrap\"> > > " > > So apparently there is nothing there. :( Now what do I do? > > > 2009/3/17 marekj : >> Welcome to Ruby and Watir. >> Glad you jumped in. It's a great language and Watir is a nice library. >> >> about your issue: you may try right after you login click to capture the >> html and see what's there; try with; >> puts ie.html.inspect >> after ie.button(how, what).click line >> >> Another possible issue may be a hidden frame (frameset). Just a wild guess >> since I've seen it happen in a couple of apps I worked with. >> >> Also I noticed that the HTML generated by IEDeveloperToolbar is not really >> the HTML that's on the page. The IEDevToolbar adds its own head info for >> meta doctype and styles. >> >> >> marekj >> >> Watirloo: Semantic Page Objects in UseCases >> http://github.com/marekj/watirloo/ >> >> >> >> On Tue, Mar 17, 2009 at 10:05 AM, Mark Lehky wrote: >>> >>> 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): >>> >>> >>> >>> >>> /* No matching styles were found. */ >>> >>> >>> >> >>> action="WebPages_ControlHost.aspx?control=aclaro.petroLook.WebControls.Generic.PageHost&pagetype=Admin&category=Bootstrap&group=Schema" >>> method="post"> >>> Activating the database enables petroLook users to log in and >>> disables the bootstrap user. >>> >>> >>> >>> >>> 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 -~--~~~~--~~--~--~---
[wtr-general] Re: Problems locating basic elements in Watir
So, you might want to try: $ie.frame(:index,1).text.include?("Activating the database") - Original Message From: Mark Lehky To: watir-general@googlegroups.com Sent: Tuesday, March 17, 2009 10:20:03 AM Subject: [wtr-general] Re: Problems locating basic elements in Watir The puts ie.html.inspect generates: petroLook - aclaro softworks, inc.\r\n " So apparently there is nothing there. :( Now what do I do? 2009/3/17 marekj : > Welcome to Ruby and Watir. > Glad you jumped in. It's a great language and Watir is a nice library. > > about your issue: you may try right after you login click to capture the > html and see what's there; try with; > puts ie.html.inspect > after ie.button(how, what).click line > > Another possible issue may be a hidden frame (frameset). Just a wild guess > since I've seen it happen in a couple of apps I worked with. > > Also I noticed that the HTML generated by IEDeveloperToolbar is not really > the HTML that's on the page. The IEDevToolbar adds its own head info for > meta doctype and styles. > > > marekj > > Watirloo: Semantic Page Objects in UseCases > http://github.com/marekj/watirloo/ > > > > On Tue, Mar 17, 2009 at 10:05 AM, Mark Lehky wrote: >> >> 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): >> >> >> >> >> /* No matching styles were found. */ >> >> >> > >> action="WebPages_ControlHost.aspx?control=aclaro.petroLook.WebControls.Generic.PageHost&pagetype=Admin&category=Bootstrap&group=Schema" >> method="post"> >> Activating the database enables petroLook users to log in and >> disables the bootstrap user. >> >> >> >> >> 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 -~--~~~~--~~--~--~---
[wtr-general] Re: Problems locating basic elements in Watir
ie = Watir::IE.new ie.goto "/petroLook4410/plugins/cache/webresources/ aclaro_petroLook_WebResources/4_4_3353_10382/ WebPages_Administration_AdministrationFrameset.aspx? category=Bootstrap" if ! ie.text.include? "Login" or ie = Watir::IE.new if ! ie.iframe(:src, / WebPages_Administration_AdministrationFrameset.aspx/).text.include? "Login" Cheers, John On Mar 17, 6:20 pm, Mark Lehky wrote: > The puts ie.html.inspect generates: > > > petroLook - aclaro softworks, inc.\r\n > > > > src=\"/petroLook4410/plugins/cache/webresources/aclaro_petroLook_WebResources/4_4_3353_10382/WebPages_Administration_AdministrationFrameset.aspx?category=Bootstrap\"> > > " > > So apparently there is nothing there. :( Now what do I do? > > 2009/3/17 marekj : > > > Welcome to Ruby and Watir. > > Glad you jumped in. It's a great language and Watir is a nice library. > > > about your issue: you may try right after you login click to capture the > > html and see what's there; try with; > > puts ie.html.inspect > > after ie.button(how, what).click line > > > Another possible issue may be a hidden frame (frameset). Just a wild guess > > since I've seen it happen in a couple of apps I worked with. > > > Also I noticed that the HTML generated by IEDeveloperToolbar is not really > > the HTML that's on the page. The IEDevToolbar adds its own head info for > > meta doctype and styles. > > > marekj > > > Watirloo: Semantic Page Objects in UseCases > >http://github.com/marekj/watirloo/ > > > On Tue, Mar 17, 2009 at 10:05 AM, Mark Lehky wrote: > > >> 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): > >> > >> > >> > >> > >> /* No matching styles were found. */ > >> > >> > >> > >> action="WebPages_ControlHost.aspx?control=aclaro.petroLook.WebControls.Generic.PageHost&pagetype=Admin&category=Bootstrap&group=Schema" > >> method="post"> > >> Activating the database enables petroLook users to log in and > >> disables the bootstrap user. > >> > >> > >> > > >> 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 -~--~~~~--~~--~--~---
[wtr-general] Re: Problems locating basic elements in Watir
The puts ie.html.inspect generates: petroLook - aclaro softworks, inc.\r\n " So apparently there is nothing there. :( Now what do I do? 2009/3/17 marekj : > Welcome to Ruby and Watir. > Glad you jumped in. It's a great language and Watir is a nice library. > > about your issue: you may try right after you login click to capture the > html and see what's there; try with; > puts ie.html.inspect > after ie.button(how, what).click line > > Another possible issue may be a hidden frame (frameset). Just a wild guess > since I've seen it happen in a couple of apps I worked with. > > Also I noticed that the HTML generated by IEDeveloperToolbar is not really > the HTML that's on the page. The IEDevToolbar adds its own head info for > meta doctype and styles. > > > marekj > > Watirloo: Semantic Page Objects in UseCases > http://github.com/marekj/watirloo/ > > > > On Tue, Mar 17, 2009 at 10:05 AM, Mark Lehky wrote: >> >> 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): >> >> >> >> >> /* No matching styles were found. */ >> >> >> > >> action="WebPages_ControlHost.aspx?control=aclaro.petroLook.WebControls.Generic.PageHost&pagetype=Admin&category=Bootstrap&group=Schema" >> method="post"> >> Activating the database enables petroLook users to log in and >> disables the bootstrap user. >> >> >> >> >> 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 -~--~~~~--~~--~--~---
[wtr-general] Re: Problems locating basic elements in Watir
Welcome to Ruby and Watir. Glad you jumped in. It's a great language and Watir is a nice library. about your issue: you may try right after you login click to capture the html and see what's there; try with; puts ie.html.inspect after ie.button(how, what).click line Another possible issue may be a hidden frame (frameset). Just a wild guess since I've seen it happen in a couple of apps I worked with. Also I noticed that the HTML generated by IEDeveloperToolbar is not really the HTML that's on the page. The IEDevToolbar adds its own head info for meta doctype and styles. marekj Watirloo: Semantic Page Objects in UseCases http://github.com/marekj/watirloo/ On Tue, Mar 17, 2009 at 10:05 AM, Mark Lehky wrote: > > 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): > > > > > /* No matching styles were found. */ > > > > action="WebPages_ControlHost.aspx?control=aclaro.petroLook.WebControls.Generic.PageHost&pagetype=Admin&category=Bootstrap&group=Schema" > method="post"> > Activating the database enables petroLook users to log in and > disables the bootstrap user. > > > > > 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 -~--~~~~--~~--~--~---
[wtr-general] Re: Problems locating basic elements in Watir
Sorry. I probably confused the issue with lumping everything into one mail. Any element I try to find on the page after my login gives me the "Unable to locate element ..." error. I then tried to simplify my test with just looking for some text on that page - that is the Ruby and HTML that I had mailed first. My test now ends with: "Test Failed! " 2009/3/17 Michael Hwee : > > > 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 > 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): > > > > > /* No matching styles were found. */ > > > action="WebPages_ControlHost.aspx?control=aclaro.petroLook.WebControls.Generic.PageHost&pagetype=Admin&category=Bootstrap&group=Schema" > method="post"> > Activating the database enables petroLook users to log in and > disables the bootstrap user. > > > > > 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 -~--~~~~--~~--~--~---
[wtr-general] Re: Problems locating basic elements in Watir
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 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): /* No matching styles were found. */ Activating the database enables petroLook users to log in and disables the bootstrap user. 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 -~--~~~~--~~--~--~---