[Wtr-general] Error selecting links within nested iFrame?
Hi, I'm running Watir 1.4.1 and Ruby 1.8.4. I'm getting UnknownObjectException when trying to click a link within an iframe within a frame. Commands as follows: This command succeeds: $ie.frame(buttonFrame).frame(linksFrame).contains_text(/CVS Revision/) These commands fail with the UnknownObjectExceptions: $ie.frame(buttonFrame).frame(linksFrame).link(:text, test1).click $ie.frame(buttonFrame).frame(linksFrame).link(:id, link_id).click The iframe with name linksFrame is the delivered links1.html unit testing file from the Watir 1.4.1 gem. Is this a known issue? I don't see it in the OpenQA database as far as I can tell. I'll clean up my tests and send a modified frames unit test and the necessary HTML files if that is desired. Thanks, Ethan ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Error selecting links within nested iFrame?
Bug submitted, but the situation gets curiouser and curiouser. My unit test seem to indicate that I can't .click links in any frame. I can't imagine that no one else has had this problem, so I have to assume that it's relatively unique to my setup. The bug report is bug 113, link: http://jira.openqa.org/browse/WTR-113 I've attached a modified frame_test.rb and the necessary .html files, so if someone feels like taking a minute to test, that would be appreciated. I will continue investigate further and attempt to determine whether this shows up in Watir 1.5. Ethan On 10/23/06, Bret Pettichord [EMAIL PROTECTED] wrote: Ethan Jewett wrote: These commands fail with the UnknownObjectExceptions: $ie.frame(buttonFrame).frame(linksFrame).link(:text, test1).click $ie.frame(buttonFrame).frame(linksFrame).link(:id, link_id).click Is this a known issue? I don't see it in the OpenQA database as far as I can tell. I'll clean up my tests and send a modified frames unit test and the necessary HTML files if that is desired. This sounds like a new problem. Please open a new bug report for it. Does this happen in Watir 1.5? ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Error selecting links within nested iFrame?
Thanks Paul, for confirming that this works. I'll close my bug. The problem I was seeing originally must be unrelated to the click method on links in frames. I'm trying to test pages generated by SAP WebDynPro ABAP components, which is a real pain, so it's likely that I missed something in writing my original test and then was led astray by using the wrong assertion type. I'll inform the list if I figure out what the problem is. I'm sure you're all on tender-hooks : ) Bret, I'm joining the wtr-development list, where this discussion probably belongs. But my preferred behavior of ie.element(*).method (where method is something like click or flash) would be for it to return the ie.element(*) object if successful and return an exception if unsuccessful. That way, if I'm not mistaken, one could do things like ie.element(*).flash.click.click to click an object twice and then make it flash. However, that's a discussion of general behavior that I'm sure will take a good deal of hashing out, especially if Watir's wait behavior precludes it. I haven't spent a great deal of time in the Watir code to determine how this sort of thing would work, but it's on the list of things to do this weekend. Thanks for all the help, Ethan On 10/25/06, Bret Pettichord [EMAIL PROTECTED] wrote: Paul, Thanks for looking at this. Ethan, What did you want assert ie.thing.click to be checking? That an error wasn't raised? If so you should be using assert_nothing_raised {ie.thing.click}. The return value of click and many other methods has not really been defined. In Watir 1.5, click happens to return the amount of time that it took to load the page after the click. It sounds like it simply return nil in 1.4. If people have opinions regarding what the return values of such methods should be, i am happy to hear them. We haven't really given much attention to this in the past, and i'm not sure whether people really care. Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Error selecting links within nested iFrame?
Indeed it would. Thanks for the catch : ) Ethan On 10/26/06, Ċ½eljko Filipin [EMAIL PROTECTED] wrote: On 10/26/06, Ethan Jewett [EMAIL PROTECTED] wrote: That way, if I'm not mistaken, one could do things like ie.element(*).flash.click.click to click an object twice and then make it flash. Actually, ie.element(*).flash.click.click would first flash an element and then click it twice. Zeljko -- http://zeljkofilipin.com/ ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Checking whether images inside a table are enabled or disabled
Vijay, It is hard to tell what, exactly, you are looking for without an example of what an enabled object looks like *and* what a disabled object looks like. However, it looks to me like Watir 1.5.1.1127 supports the following methods for every object on a web-page: exists? enabled? attribute_value(attribute_name) I think at least one of these can be used to solve your problem. Ethan On 12/1/06, vijay [EMAIL PROTECTED] wrote: Hello people, I have got to check whether images present in a table are enabled or disabled. I am not even very sure whether they are images. Their html content: is like the following: td class=tab_enabledimg class=tab src=/iam/images/tab_left_inactive.png/td td class=tab_enabled background=/iam/images/tab_inactive_bg.png/tdtd class=tab_enabled_label background=/iam/images/tab_inactive_bg.png class=tab_enabled a class=tab_enabled href=javascript:formSubmit('summary');Stepnbsp;1.nbsp;Details/a /td Is there a way that I can check whether this image (or link or label) is enabled or not? Thanks, in advance, Vijay - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5565messageID=15503#15503 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How does one access a web page element by its css class?
Nathan, I believe that in 1.5.1127, you can also loop through images and check the class attribute. @ie = Watir::IE.new @ie.goto(http://somepage.com) @ie.images.each do |image| if image.attribute_value(class) == btn_viewResults # Image found else # This image isn't the one end end I don't think it does regular expression matches, but maybe someone can correct me if I'm wrong. Ethan On 12/7/06, Nathan [EMAIL PROTECTED] wrote: Thank you Jlolis. That does help me. I was trying to do that, because I'd seen other people do it. Here's the problem that I've come up against with doing that. The containing web element is a div, and when I do this: ie.div(:id, viewResultsButton).images I get an error: NoMethodError: undefined method 'document' for #Watir::Div:0x2dd9940. Then when I try: ie.div(:id, viewResultsButton)[1].image(:index, 1).click I also get an error: NoMethodError: undefined method '[]' for #Watir::Div:0x2dd2ed8. I pretty much already knew that would be the case. I'm not dumb, and the first error told me already, forget about it! So how woulld one accomplish this with a div!? thanks, Nathan - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5661messageID=15811#15811 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How does one access a web page element by its css class?
Actually, of course it does regular expression matches, they're just regular Ruby regular expressions because there's no need to do a regular expression match in the .attribute_value method call. On 12/7/06, Ethan Jewett [EMAIL PROTECTED] wrote: Nathan, I believe that in 1.5.1127, you can also loop through images and check the class attribute. @ie = Watir::IE.new @ie.goto(http://somepage.com) @ie.images.each do |image| if image.attribute_value(class) == btn_viewResults # Image found else # This image isn't the one end end I don't think it does regular expression matches, but maybe someone can correct me if I'm wrong. Ethan On 12/7/06, Nathan [EMAIL PROTECTED] wrote: Thank you Jlolis. That does help me. I was trying to do that, because I'd seen other people do it. Here's the problem that I've come up against with doing that. The containing web element is a div, and when I do this: ie.div(:id, viewResultsButton).images I get an error: NoMethodError: undefined method 'document' for #Watir::Div:0x2dd9940. Then when I try: ie.div(:id, viewResultsButton)[1].image(:index, 1).click I also get an error: NoMethodError: undefined method '[]' for #Watir::Div:0x2dd2ed8. I pretty much already knew that would be the case. I'm not dumb, and the first error told me already, forget about it! So how woulld one accomplish this with a div!? thanks, Nathan - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5661messageID=15811#15811 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to handle javascript pop ups from drop down lists
Akash, Hopefully someone has a simpler solution, but my solution was to mixin (using a module) a new method to the offending class (in your case SelectList) called select_no_wait(item). The contents of this method would be the same as the select(item) method, but without the @container.wait. My problem was with the IE.goto method, not with list selection, so the execution won't be quite the same, but the idea is there. I don't have much time right now, but if no one responds with another fix within the next 12 hours or so, I'll try to post the code that should do that job. Ethan On 12/14/06, Akash [EMAIL PROTECTED] wrote: Hi, I am getting a javascript pop up after i select a value from some drop down list using the select_list method. Since i can not use click_no_wait for a list, how am i supposed to handle the pop up. Moreover this pop up generates from a modal window and that has added to my woes. Can anyone please provide a solution for it. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5778messageID=16178#16178 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to handle javascript pop ups from drop down lists
This is what I did to the goto method: File Name: watir_mixin.rb * module WatirMixin def goto_no_wait(url) # These are the contents of the Watir::goto method, without the wait call @ie.navigate(url) # I also left of the explicit return value because I don't use it end end * Then, in my test case: * require '../../watir_mixin.rb' require 'watir' include Watir class IE include WatirMixin end class Watir::Frame include WatirMixin end ie = Watir::IE.new ie.goto_no_wait(http://site_with_popup_during_load.com;) I think you can do almost the same thing with a mixin module for the SelectList class: Find the class in the watir.rb file. Find the select(item) method (which calls another method, to complicate things). Copy the contents of the method with the guts of select(item). In your mixin module, define a new method called select_no_wait(item) or something similar. Paste in the contents from the previous paragraph. Delete the @container.wait line. And you should be good to go. Past results are no guarantee of future performance, etc. Also, using mixins like this, I believe you run a risk of getting stepped on by methods added to future releases of Watir that happen to have the same name as methods you have defined in mixins. Questions for the list: 1) Is there an easier way to do this? 2) If not, what with the growing popularity of javascript events triggered by such things as list selection, button clicking, etc, would it be a popular idea to start defining a framework for alternate behaviors like no_wait of action methods like click, goto, select, etc? One suggestion: All action methods take an optional hash as a parameter, allowing for click(:no_wait = true) to have the same behavior as click_no_wait. In Akash's case, he could use select(item, :no_wait = true). I'd be happy to contribute some test cases if this sounds like a decent approach. Ethan On 12/14/06, Ethan Jewett [EMAIL PROTECTED] wrote: Akash, Hopefully someone has a simpler solution, but my solution was to mixin (using a module) a new method to the offending class (in your case SelectList) called select_no_wait(item). The contents of this method would be the same as the select(item) method, but without the @container.wait. My problem was with the IE.goto method, not with list selection, so the execution won't be quite the same, but the idea is there. I don't have much time right now, but if no one responds with another fix within the next 12 hours or so, I'll try to post the code that should do that job. Ethan On 12/14/06, Akash [EMAIL PROTECTED] wrote: Hi, I am getting a javascript pop up after i select a value from some drop down list using the select_list method. Since i can not use click_no_wait for a list, how am i supposed to handle the pop up. Moreover this pop up generates from a modal window and that has added to my woes. Can anyone please provide a solution for it. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5778messageID=16178#16178 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Referencing dynamically generated objects
Bret, It looks to me like the following piece of code in watir.rb (after the second method of the Watir module) is causing rdoc to stop parsing at that point. # add an error checker for http navigation errors, such as 404, 500 etc NAVIGATION_CHECKER = Proc.new do |ie| if ie.document.frames.length 1 1.upto ie.document.frames.length do |i| begin ie.frame(:index, i).check_for_http_error rescue Watir::Exception::UnknownFrameException # frame can be already destroyed end end else ie.check_for_http_error end end When I comment this out, rdoc seems to get everything. Ethan On 1/3/07, Bret Pettichord [EMAIL PROTECTED] wrote: Dave Munns wrote: Thanks Brett, that worked! Is there documentation that describes the arguments available for each object? I was going to say that you could look at the rdoc for Watir::Element, but for some reason this is not being generated. If anyone knows how to debug RDOC problems, i'd appreciate any advice you could give. Specifically, no doc is being generated for Watir::Element or any of its subclasses. Other classes are not getting all their methods documented. Use rake rdoc to generate rdoc for our source. If you are using the gem, you can get the current (incomplete) rdoc from the gem rdoc server. Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Installation Problem
It's been a while since I tried an executable installer so I'm not sure about your specific problem. It looks like you've got a space in your path, which can cause problems in some scripts. As with all things Ruby, it tends to be easier to go the Ruby Way and use the gem installer. Figuring out the Ruby Way is the hard part : ) If you open your command prompt and type: gem install watir That should install Watir 1.4.1 as a Ruby gem, which will probably take care of the issue. You'll then be able to find the Watir install and unit tests under ruby/lib/ruby/gems/1.8/gems/watir . . . where the first ruby is your root ruby install directory. If that command (gem) is not a recognized command, then you do indeed have a path issue, and you might want to try reinstalling ruby under the C:\ directory, or following a howto on adding a directory to your PATH like http://www.computerhope.com/issues/ch000549.htm. Just add your ruby/ directory to the path and you should be all set. Ethan On 2/2/07, RobG [EMAIL PROTECTED] wrote: I hope this is an acceptable topic for this list... I just installed Ruby 1.8.5 on my system, and then, with much effort, managed to get the watir-1.4.1.exe installed (it has a major install bug that I was able to circumvent). So after all that, I open a command prompt into the installation location, and run all_tests.rb as instructed, and I get the errors below: C:\Program Files\Watir\unittestsall_tests.rb C:/Program Files/Watir/unittests/../unittests/setup.rb:4:in `require': no such f ile to load -- watir (LoadError) from C:/Program Files/Watir/unittests/../unittests/setup.rb:4 from C:/Program Files/Watir/unittests/all_tests.rb:4:in 'require' from C:/Program Files/Watir/unittests/all_tests.rb:4 It looks like it might be a simple pathing issue, but I'm not sure. I do have the path setup so that I can run regular ruby, but I haven't tried to add anything for watir yet; I thought I would ask here first. I don't remember having this problem about eight months ago when I first tried Watir, but that was on another computer. Any help would be appreciated. Thanks! Rob ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Unable to access a modal dialog box to select a
Vijay, It looks like you've got the wrong frame. frame(:index,1).html just contains a hidden input, so it probably isn't the frame that is displayed. Maybe try frame(:index,2). If you methodically go through all frames and subframes in the modal, you'll find the one you want eventually. There is useful advice about displaying and manipulating frames under the Frames section of the user guide: http://www.openqa.org/watir/watir_user_guide.html Ethan On 2/2/07, vijay [EMAIL PROTECTED] wrote: Hello people, I tried a few commands in an attempt to get more details about the objects in the modal dialog box. 1. Output of the command, puts ie.modal_dialog.frame(:index,1).html HTMLHEADTITLE/TITLELINK href=../../styles/css_remote/styles.css type=text/css rel=stylesheet/HEADBODY class=bodydialogFORM id=Form1 name=Form1 action=EmptyPage.aspx method=postINPUT type=hidden value=dDwtNjU0MzcyMTk1Ozs+2C7FwmeFdeDCpDsFGmQL7wdu1oU= name=__VIEWSTATE /FORM/BODY/HTML 2. output of the command, puts ie.modal_dialog.frame(:index,1).show_all_objects text/css id= hiddenname=__VIEWSTATEid= value=dDwtNjU0MzcyMTk1Ozs+2C7FwmeFdeDCpDsFGmQL7wdu1oU= alt= src= 3. Output of the command, puts ie.modal_dialog.frame(:index,1).text Blank 4. Output of the command, puts ie.modal_dialog.frame(:index,1),form(:id,'Form1').html FORM id=Form1 name=Form1 action=EmptyPage.aspx method=postINPUT type=hidden value=dDwtNjU0MzcyMTk1Ozs+2C7FwmeFdeDCpDsFGmQL7wdu1oU= name=__VIEWSTATE /FORM 5. Output of the commands, puts ie.modal_dialog.frame(:index,1).form(:id,'Form1').show_all_objects and puts ie.modal_dialog.frame(:index,1).form(:index,1).show_all_objects ---Objects in page - hiddenname=__VIEWSTATEid= value=dDwtNjU0MzcyMTk1Ozs+2C7FwmeFdeDCpDsFGmQL7wdu1oU= alt= src= 6. Output of the command, puts ie.modal_dialog.frame(:index,1).form(:index,2).html c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1145/./watir.rb:2297:in `assert_exists': Unable to locate object, using index and 2 (Watir::Exception::UnknownObjectException) 7. Output of the command, puts ie.modal_dialog.frame(:index,1).form(:index,2).show_all_objects ---Objects in page - c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1145/./watir.rb:1013:in `show_all_objects': undefined method `all' for nil:NilClass (NoMethodError) 8. Output of the command, puts ie.modal_dialog.frame(:index,1).text Blank I am not able to proceed anything beyond this. I do not know how to get the properties of the list of displayed values (from which I need to select a value) and the 'Ok' button. Also the command 'flash' is not 'flashing' the modal dialog box and the frame and the form within it. Please help me to make Watir to select a value from this dialog box and click the 'Ok' button.. Thanks for your time, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6357messageID=18107#18107 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] ci-reporter question
gem replaced require_gem, sort of - http://redhanded.hobix.com/bits/require_gemIsDeprecated.html However, you seem to have a recent enough version of rubygems that this shouldn't be a problem. Maybe there's a missing require 'rubygems' somewhere? Ethan On 2/27/07, Bret Pettichord [EMAIL PROTECTED] wrote: I'm getting an error with ci_reporter on my CI box. It works on my development machine. I've tracked the error down to the gem command, found here: def create_builder begin gem 'builder' require 'builder' rescue begin gem 'activesupport' require 'active_support' rescue raise LoadError, XML Builder is required by CI::Reporter end end unless defined?(Builder::XmlMarkup) # :escape_attrs is obsolete in a newer version, but should do no harm Builder::XmlMarkup.new(:indent = 2, :escape_attrs = true) end I'm getting undefined method 'gem'. I can't figure out where this method is supposed to be defined. I have the latest rubygems (0.9.2). And builder and activesupport. Any hints? Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Wait issue with file_field.set, solution
I think that the addition of the click to file_field.set in this change (see thread below) is causing one of my tests to hang during the @container.wait in the click method. However, this problem didn't show up until after the changes to the wait functionality in mid-February. Or so my theory goes . . . The fix, in my case, is to change the click to a click! in file_field.set, by-passing the @container.wait in the click method. I suppose I could use a time-out technique instead. I can't provide a test case, unfortunately, because I don't have a handle on all the javascript eventing and fancy ajax-y reload in various frames that's going on in a generated SAP business server pages app. I think this is a relatively well-known issue with ajax-like apps. Please correct me if I'm wrong. Attached is a patch to the 1.5.1163 revision that illustrates the way I've modified watir.rb to allow me to specify wait behavior in the file_field.set method. The watir 1.5.1163 - no_wait option in file_field.set.patch basically throws any extra arguments on file_field.set into an args_hash Hash. The set method then checks for the :no_wait key and either clicks or click!s based on that key. So, file_field.set(path) results in a click file_field.set(path, :no_wait = false) results in a click file_field.set(path, :no_wait = true) results in a click! The upside here is that this doesn't change existing behavior. The downside is that it is kind of a hack as it stands. I think that implementing this sort of functionality in a more general (and perhaps better thought-out) way would give a lot of flexibility to those of us dealing with ajax goodness to manually override wait functionality when necessary. It might also be a reasonably standard way to allow granular control of other functionality on a method-call by method-call basis. Is this reasonable? Has something like this been decided against in the past? Is it too big a change for 1.5? Thoughts on problems? Improvements? Maybe using :wait = false instead of :no_wait = true would be more intuitive? I don't think this patch is ready to go into the code-base as it stands, even if people think it is a reasonable approach, but I'll submit a Jira ticket once I have something that I think will work. Thanks, Ethan On 1/10/07, Bret Pettichord [EMAIL PROTECTED] wrote: John Lolis wrote: I registered AutoItX3.dll using regsvr32 and it got rid of the error message, the problem now is it doesn't fill in the field with any text. I can flash it, so i know I have the right field - I just can't put anything in there. any more ideas? Today I checked in fixes for both this and the other problem (autoit registration). These are NOT in today's dev gem, but will be in the next one. You can pull them from trunk if you like. A workaround for this problem for earlier versions of 1.5 is this: 1. Manually register autoit: regsvr32 AutoItX3.dll 2. Add a call to click: ie.file_field(:id, 'DriverFileUpload_DriverFileUpload').set(filename) ie.file_field(:id, 'DriverFileUpload_DriverFileUpload').click Please let us know if either of these solutions does not fix this problem for anyone. Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general watir 1.5.1163 - no_wait option in file_field.set.patch Description: Binary data ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Tables nested in a div
John, I believe the .tables method returns an array of all the tables within div, so .tables[0] will return the first table in the div. Try: mainFrame.div(:id, menuId).tables[1].click Ethan On 3/15/07, John Lloyd-Jones [EMAIL PROTECTED] wrote: I have a tricky page where I need to click on a a menu that has been implemented as a table. There are many such menus and I can find the surrounding div (by id), but there is no other way to find the table (it doesn't have a predictable index, for example). So what I want is to ask the Div for the table -- where it is in fact, the only nested table). E.g. menu = mainFrame.div(:id, menuId) menuTable = menu.table(:index, 1) menuTable[ 4 ][ 1 ].click Alas, this doesn't work out of the box -- Watir assumes that you always want to find tables nested in the document, so it errors out on menu.table() saying that there is no document. As tables are commonly nested in divs, and as far as I can see, adding a table method to the Div class wouldn't break any current code, is there any reason why Div couldn't do something like this? class Watir::Div def table( how, what ) if how == :index @o.getElementsByTagName( 'table' )[what.to_s] Table.new(@ieController, :from_object, table) else super.table( how, what ) end end end The table method overrides the super class for :index, but not for :id (which should be unique, so it doesn't need special handling). It certainly does make the code snipped abpve work. I haven't done any exhaustive tests to see if it breaks anything, but I can't think of any scenario where it could. John ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to access browser authentication pop-up
Oscar, In my experience, the easiest thing to do is to hack up your goto method to allow for an option that doesn't wait for the page to load before passing back control to your script. Then, assuming you can get your username and password saved in your browser, you can just use AutoIT to send an Enter keystroke to clear the dialog with a successful login. There's a patch (the larger) attached to this issue that contains such a code change and allows you to use the syntax below for the goto method: http://jira.openqa.org/browse/WTR-146 NOTE: This will not work without aforementioned patch! @application_base = http://yoursite.com; $ie.goto(@application_base, :wait = false) sleep 7 @autoit = WIN32OLE.new('AutoItX3.Control') @autoit.Send {ENTER} @autoit = nil sleep 5 Once you get that working, you could experiment with using AutoIT or the WinClicker that comes with Watir (I've never really been able to get this to work, but YMMV) to populate usernames and passwords in the dialog. Maybe someone else can give an example . . . Ethan On 3/21/07, Oscar [EMAIL PROTECTED] wrote: Hello, thanks in advance for any help you can give me. I'm trying to begin writing a test for an internal app. The website uses simple Apache Browser authentication so it pops up with a Windows-looking authentication window. I've searched high and low for help on this but I can't find how to interact with this so I thought I'd ask here. I've searched for: windows security browser authentication login logon login pop up default browser pop up and a bunch of other terms. I can't find anything related... google, or here. How do I go about entering a username and password on this? I tried using irb to and all_objects to see if i could find anything but the moment I go to the site, irb will be just waiting for the page to finish loading so I can't even query it to see what is available to me. Any ideas? Here's a screenshot of the window I get just so you see exactly what I'm talking about. http://www.flickr.com/photos/[EMAIL PROTECTED]/429653070/ ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] JS Alert from a checkbox
This (http://jira.openqa.org/browse/WTR-146) ticket and patch outlines a possible framework for dealing with this throughout watir. Might be a decent reason to vote for the feature on Jira. In the meantime, the method of modifying the methods in watir.rb in the patch should work for your problem as well, but you'll be stuck patching watir.rb every time you install. Ethan On 4/16/07, Cain, Mark [EMAIL PROTECTED] wrote: Does anyone have an answer to this? I can't seem to get the click_no_wait to work for checkboxes. --Mark From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cain, Mark Sent: Friday, April 13, 2007 10:05 AM To: wtr-general@rubyforge.org Subject: [Wtr-general] JS Alert from a checkbox I have a JS Alert that popups from clicking a checkbox. How can I use the click_no_wait functionality for the 'set' method of the checkbox? Thanks, Mark L. Cain LMIT - E*STARS(r) ~ Lead Test Engineer 1981 Snyder, MSIN: G3-62, Richland, WA 99354 [EMAIL PROTECTED] 509.376.5458 640 Kilobytes of computer memory ought to be enough for anybody. - Bill Gates, 1981 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Using an ie.table.each do |row| loop when the page in the ie window refreshes itself
Ian, Reloading probably invalidates the table object, resulting in your Access denied error when ruby goes back for the next row in the table. Suggestion: Assuming that submitting and reloading doesn't affect the table layout, use rows.each_with_index to build an array of indices of relevant rows. Then cycle through the array clicking and submitting. For instance (untested, unfortunately): rows_to_click = Array.new ie.table(:index, 29).rows.each_with_index do |row, i| rows_to_click i if (row[1].text =~ /#{journals}/) != nil end rows_to_click.each do |i| [Do the clicking and such for row i here.] end This could be made substantially prettier, but hopefully it gets the job done. Ethan On 5/4/07, Ian Webb [EMAIL PROTECTED] wrote: Here's the code snippet that's giving me problems: ie.table(:index,29).each do |row| if (row[1].text =~ /#{journals}/) != nil then #If there is a match for that regex row[5].link(:index,1).click # this makes the popup window appear cw = Watir::IE.attach(:title,'Popup Window') # attach to the popup window doRolesPopup(cw) # fill out and submit the form end end doRolesPopup fills out a form in the cw page, then clicks submit. The submit button submits the form, then closes the cw window and reloads the ie window. This reload of the page referenced by the ie object appears to break the row object, since I get the following error: c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2461:in `invoke': unknown property or method `rows' (WIN32OLERuntimeError) HRESULT error code:0x80070005 Access is denied. from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2461:in `row' from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2404:in `each' from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2404:in `upto' from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2404:in `each' from assignroles.rb:51 from c:/ruby/lib/ruby/1.8/csv.rb:532:in `parse' from c:/ruby/lib/ruby/1.8/csv.rb:560:in `each' from c:/ruby/lib/ruby/1.8/csv.rb:531:in `parse' from assignroles.rb:35 Is there any way to keep this simple .each loop, or do I need to work around it? Thanks, Ian ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Modal dialog
Does the following work? http://rubyforge.org/pipermail/wtr-general/2005-April/001461.html There are a couple of other examples on the FAQ including one that uses click_no_wait, which I think won't block the current process, though you'll have to handle timing issues yourself as with the startClicker exampe: http://wiki.openqa.org/display/WTR/FAQ Ethan On 6/7/07, Hayato Iriumi [EMAIL PROTECTED] wrote: I spawned another process, but no luck. I tried system and exec, but Ruby waits for the line to finish. Any other way to spawn another process? On 6/7/07, Bret Pettichord [EMAIL PROTECTED] wrote: Hayato wrote: Does anyone know how to resolve this issue? Please let me know. Don't use threads. Blocking COM calls will block ALL ruby threads. You'll have to spawn code to run in a separate process instead. Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] click link in iframe?
Mihai, What is the code you are trying to use to click this menu link? It will need to be something like ie.frame(:index, 1).link(:text, Link text here).click You might want to consider using something like the IE Developer Toolbar or Firebug to see what is inside the iframe. Ethan On 6/8/07, mihai [EMAIL PROTECTED] wrote: no ideea? ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general