[wtr-general] field in page names 'class'
I have a field which should be defined as class ViewActivityPatternPage Taza::Page field(:class) {logon_frame.span (:id, /.*:ActivityClass$/)} ... end but as soon as the page object is instantiated I get undefined method `class_field' for #ClaimCenter::ViewActivityPatternPage: 0x79a04f0 (NoMethodError) C:/workspace/Guidewire/Common/lib/steps/header_steps.rb:10:in `__instance_ exec0' C:/workspace/Guidewire/Common/lib/pages/GuidewirePage.rb:8:in `initialize' (eval):2:in `new' (eval):2:in `view_activity_pattern_page' (eval):1:in `__instance_exec0' .. Is there a way to define a field with the name 'class'? Andy --~--~-~--~~~---~--~~ 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: Accessing text elements in a span
Thanks, It worked - except that before_text and after_text seem to be reversed in watir 1.6.3. I used after_text and got what I needed. Andy On Apr 13, 7:09 pm, orde ohil...@gmail.com wrote: Looks like this would do it: puts browser.link(:index, 1).before_text On Apr 13, 2:31 pm, andrew.d...@lthree.com wrote: if I have some html that looks like span id='myid' text1 a link text/a text 2 select.../select text 3 /span what is the Watir command to pull out just 'text 2'? Andy- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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] First level children only
I have a large tree of nested divs, and I want to get an array of just the direct children of any particular div. I do not know ahead of time how many divs there will be at any level. Starting from a div, what is the Watir code for getting the divs that are direct children (and yes, there are other element types mixed in throughout)? Example div id=1 div/ div div/ div/ /div div/ /div divs() returns the entire list of all descendant div elements. I want just the first level children. Andy --~--~-~--~~~---~--~~ 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: First level children only
How can xpath be used to return an array of divs? What would the xpath look like? On Apr 14, 10:30 am, Michael Hwee michael_h...@yahoo.com wrote: Can you try xpath? - Original Message From: andrew.d...@lthree.com andrew.d...@lthree.com To: Watir General watir-general@googlegroups.com Sent: Tuesday, April 14, 2009 7:54:53 AM Subject: [wtr-general] First level children only I have a large tree of nested divs, and I want to get an array of just the direct children of any particular div. I do not know ahead of time how many divs there will be at any level. Starting from a div, what is the Watir code for getting the divs that are direct children (and yes, there are other element types mixed in throughout)? Example div id=1 div/ div div/ div/ /div div/ /div divs() returns the entire list of all descendant div elements. I want just the first level children. Andy- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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] Accessing text elements in a span
if I have some html that looks like span id='myid' text1 a link text/a text 2 select.../select text 3 /span what is the Watir command to pull out just 'text 2'? Andy --~--~-~--~~~---~--~~ 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] IE crashes at end of test
Wondering if anyone ran into this and solved it. Had a machine which has been running my tests fine for months. It was updated and rebooted and now IE crashes about 50% of the time when closing the browser at the end of a test. Prevents other tests from starting. Windows XP IE 7.0.5730.13 Watir 1.6.3 Watircraft 0.4.0 Running under VMWare I have other machines with the exact same config that run fine. But I have a Vista machine that also has this error (non-VMWare Vista box). Have tried all the normal stuff, google no help. Has anyone else seen this? Here is the ugly error msg IEEXPLORE.EXE – Application Error The instruction at “0x0580715d” referenced memory at “0x8ccc0082”. The memory could not be “written”. Click on OK to terminate the program Click on CANCEL to debug the program Andrew --~--~-~--~~~---~--~~ 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: Are there IE Settings that can cause Watir to fail?
Here is a code snippet. logon_page.top_frame.contains_text('some text').should_not be_nil in logon_page.rb I have def logon_frame @browser.frame(:id, 'top_frame') end alias :top_frame :logon_frame and I gaurantee that there is a frame with id = 'top_frame' Fails with error message: Then in the Logon page I should see Guidewire ClaimCenter text # teps/then_common.rb:689 Unable to locate a frame with id top_frame (Watir::Exception::UnknownFrame Exception) c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.3/lib/watir/frame.rb: 48:in `locat e' c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.3/lib/watir/frame.rb: 55:in `initi alize' c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.3/lib/watir/ container.rb:102:in ` new' c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.3/lib/watir/ container.rb:102:in ` frame' C:/Users/pinal/workspace/GuideWire/Guidewire/ClaimCenter/lib/ pages/logon_p age.rb:7:in `top_frame' C:/Users/pinal/workspace/GuideWire/Guidewire/Common/lib/steps/ then_common. rb:690:in `Then /^in (?:the )?(.*) page I should see (.*) text$/' test/features/testing.feature:10:in `Then in the Logon page I should see G uidewire ClaimCenter text' By putting some traces in frame.rb inside the watir 1.6.3 project, I know that it is never entering the for loop that loops over all the frames. On Apr 8, 12:11 pm, Tiffany Fodor tcfo...@comcast.net wrote: Hi Andrew! Could you please provide a sample of your code and the error you're getting? Thanks! -Tiffany On Apr 8, 12:10 pm, andrew.d...@lthree.com wrote: I am installing on a new machine, and watir fails searcing for its first element (a frame in this case). The exact code works on many other machines. So is there anything about IE that can cause watir to fail like this? Andrew- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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] Field type changes
I have a table cell that sometimes holds a span and sometimes holds a select list. I was trying a begin/rescue like this; begin puts looking for select list @row.cell(:index, 2).select_list(:index, 1) rescue Exception = e puts looking for span @row.cell(:index, 2).span(:index, 1) end I get the 'looking for select list' message, but never the 'looking for span' message. Instead I get c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.3/lib/watir/element.rb:52:in `assert_exists': Unable to locate element, using :index, 1 Is there a way to rescue an assert_exists failure? Andy --~--~-~--~~~---~--~~ 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: Field type changes
1) The column def is part of a larger table def. I would have to either repeat the column def or the entire table to handle the two types. 2) Defining multiple columns would make it impossible for me to scan down that column and choose a row based on a value in that column. 3) Defining multiple tables would lead to an explosion of table defs and is simply not practical. I would need a separate table def for every combination of types in different columns. So its the desire to scan a column for a specific value that drives this, along with the fact that my columns are defined inside table objects. On Mar 16, 4:44 pm, Charley Baker charley.ba...@gmail.com wrote: I guess I would question why you'd do that; and those seem like different tests. But unless you give me a reason, I'd treat them separately. Charley Baker blog:http://blog.charleybaker.org/ Lead Developer, Watir,http://wtr.rubyforge.org QA Architect, Gap Inc Direct On Mon, Mar 16, 2009 at 4:27 PM, andrew.d...@lthree.com wrote: I have a table cell that sometimes holds a span and sometimes holds a select list. I was trying a begin/rescue like this; begin puts looking for select list �...@row.cell(:index, 2).select_list(:index, 1) rescue Exception = e puts looking for span @row.cell(:index, 2).span(:index, 1) end I get the 'looking for select list' message, but never the 'looking for span' message. Instead I get c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.3/lib/watir/element.rb:52:in `assert_exists': Unable to locate element, using :index, 1 Is there a way to rescue an assert_exists failure? Andy- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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: Overiding onclick javascript
What follows is a working solution and some lessons learned in handling popups. Thanks for everyone that has helped along the way. I needed to handle confirmation popups. After trying autoit based solutions without success, I decided to try a solution that has worked for me in the past - overriding the javascript that displays the popup. The two things that made this hard are : 1) I was working within a frame, 2) IE. When you are working within a frame environment, you must call execScript on the frame's window. This is because IE - unlike all other browsers - only passes a reference to your function. The function will get called, but any references to the js object 'window' will be to the window where the js resides, not the window for the frame containing the button. I would probably not have this problem with any other browser (although I haven't actually tested it as my app doesn't run on anything but IE) The final working code looks like: onclick_js = function(event){ onclick_js +=event = window.event; onclick_js +=if(event){ onclick_js += alert('found event'); onclick_js +=} else { onclick_js += alert('no event available'); onclick_js +=} onclick_js += } js = var myelem=document.getElementById(' + html_id + '); js += if(myelem){ js +=myelem.onclick= + onclick_js + ; js += } @browser.frame(:id, 'top_frame').document.parentWindow.execScript (js, javascript) Please note the last line. Here is an alternative that did NOT work. @browser.document.parentWindow.execScript(js, javascript) # seems to work, but no event object is available to handler!! Thanks and I hope this helps someone else. On Mar 13, 5:54 am, Andy Sipe ajs.gene...@gmail.com wrote: Using this html file: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//ENhttp://www.w3.org/TR/html4/strict.dtd; html head titleSample/title script type=text/javascript function doSomething(e) { alert('inside preexisting hanlder'); alert((window.event ? '' : 'not ') + 'found : window.event'); alert((e ? '' : 'not ') + 'found : window.event'); } /script /head body div button id=oneOne/button button id=twoTwo/button /div /body /html and this ruby code: require 'watir' include Watir module Watir class IE def run_script(js) ie.document.parentWindow.execScript(js) end end end ie = IE::start('c:/test.html') ie.button(:id, 'one').click #does nothing - no handler ie.run_script(document.getElementById('one').onclick=doSomething) p 'clicking one' ie.button(:id, 'one').click #shows doSomething handler ie.run_script(var func = function() { + alert(window.event ? 'found' : 'not found'); if (window.event) alert(window.event.altKey);+ }; + document.getElementById('two').onclick=func); p 'clicking two' ie.button(:id, 'two').click #shows injected handler #press two manually here with alt held down to see event info --- See what you get. You mentioned IE, so I tried it on IE 6 (the only IE I have laying around). There are a lot of ways to attach event handlers in javascript and I'm not a javascript wizard by any means so I'm sure there are better ways. Hope it helps. -andy On Thu, Mar 12, 2009 at 2:54 PM, andrew.d...@lthree.com wrote: Yea, I've tried passing it as a parm with no luck also. Everything says it is supposed to work, but I can't get it. -~--~~~~--~~--~--~ Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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: Overiding onclick javascript
Yea, I've tried passing it as a parm with no luck also. Everything says it is supposed to work, but I can't get it. On Mar 12, 12:11 pm, Andy Sipe ajs.gene...@gmail.com wrote: Take a look at this W3 schools link, it may help:http://www.w3schools.com/jsref/jsref_onkeypress.asp Note how they pass the event from the link: onmousedown=getEventTrigger(event) vs onmousedown=getEventTrigger() Maybe that will help - andy On Thu, Mar 12, 2009 at 1:06 PM, andrew.d...@lthree.com wrote: Thanks for all your help on this - I wouldn't have gotten this far without it. I have attached to an onclick of a link, and the function is being called. My only remaining issue is a missing 'event' object in the js. This is on ie. Here is the js function being attached to onclick: onclick_js = function(){ onclick_js = alert('button clicked'); onclick_js += event = window.event; onclick_js += if(event){ onclick_js += alert('found event'); onclick_js += } else { onclick_js += alert('no event available'); onclick_js += } onclick_js += } I get the alert 'button clicked' and then 'no event available'. Has anyone tried this and/or have any ideas on what to try. (I have tried passing event as a parm to the funcion - no difference). In case it helps, here is the code that attaches this js to the onclick. js = var top_frame=document.getElementById('top_frame'); js +=if(top_frame){ js += var myelem=top_frame.contentWindow.document.getElementById (' + html_id + '); js += if(myelem){ js += myelem.onclick= + onclick_js + ; js += } js +=}; #puts exec_js is + js SITE.browser.document.parentWindow.execScript(js, javascript) On Mar 11, 1:04 pm, andrew.d...@lthree.com wrote: snip...- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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: Overiding onclick javascript
When I tried this I got undefined method `Document' for #Watir::IE:0x4288648 (NoMethodError) Is Watir::IE the correct object to be using here? On Mar 11, 8:53 am, Andy Sipe ajs.gene...@gmail.com wrote: You should be able to read it using xpath or some other technique. I don't believe you can set it directly with watir. However you can always inject javascript that will change the handler. Something like: @ie.Document.parentWindow.execScript($('eleid').onclick = 'alert('hi');'); I didn't test that and I'm pretty sure the embedded and ' are wrong but you should be able to get the idea of how to set the handler. -andy On Wed, Mar 11, 2009 at 10:33 AM, andrew.d...@lthree.com wrote: So I am clicking on a link that has an onclick handler. I would like to read/write the onclick handler. Is there a way to get at that. Just trying element.onclick = sss didn't work and neither did element.click = sss Is there a way to do this? Andy- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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: Overiding onclick javascript
Here is a sample. This code does not throw any exceptions. js1,2,3 all result in a popup. js 4 does not - indicating that it is not finding the element I want. I gaurantee that the html element I am looking for is a child of top_frame. In fact, the code that calls this block checks that the html element exists using watir. js1= alert('hi'); js2 = var top_frame=document.getElementById('top_frame'); if (top_frame){alert('found top');}; js3 = var top_frame=document.getElementById('top_frame'); if (top_frame){var myelem = top_frame.document.getElementById(' + html_id + '); alert('found top');}; js4 = var top_frame=document.getElementById('top_frame'); if (top_frame){var myelem = top_frame.document.getElementById(' + html_id + '); if(myelem){ alert('found elem');}}; js = js4; puts my js for + html_id + is + js SITE.browser.document.parentWindow.execScript(js, javascript) Any ideas on what I should be using to access an element inside a frame? Note: I already tested without all the frame stuff, and it doesn't work either. Andy On Mar 11, 10:58 am, Andy Sipe ajs.gene...@gmail.com wrote: Post a sample of your code. Remember that when you inject the JS you are working only with the dom and the browser JS engine. Nothing watir related. The error your are posting leads me to believe that somewhere you are treating something that should be JS as something in ruby. -andy On Wed, Mar 11, 2009 at 12:25 PM, andrew.d...@lthree.com wrote: Yea, I remembered that 2 secs after posting. Does anyone know anyway to debug js being run with execScript? I am getting execScript OLE error code:80020101 in Unknown Could not complete the operation due to error 80020101. HRESULT error code:0x80020009 Exception occurred. (WIN32OLERuntimeError) C:/workspace/Guidewire/Common/lib/pages/GuidewirePage.rb:313:in `method_mi ssing' Note: I can get some js to work, such as alert('hi'), but it always fails when I use getElementById('someid') On Mar 11, 9:30 am, Andy Sipe ajs.gene...@gmail.com wrote: lower case 'd' @ie.document Sorry about that. -andy On Wed, Mar 11, 2009 at 11:02 AM, andrew.d...@lthree.com wrote: When I tried this I got undefined method `Document' for #Watir::IE:0x4288648 (NoMethodError) Is Watir::IE the correct object to be using here? On Mar 11, 8:53 am, Andy Sipe ajs.gene...@gmail.com wrote: You should be able to read it using xpath or some other technique. I don't believe you can set it directly with watir. However you can always inject javascript that will change the handler. Something like: @ie.Document.parentWindow.execScript($('eleid').onclick = 'alert('hi');'); I didn't test that and I'm pretty sure the embedded and ' are wrong but you should be able to get the idea of how to set the handler. -andy On Wed, Mar 11, 2009 at 10:33 AM, andrew.d...@lthree.com wrote: So I am clicking on a link that has an onclick handler. I would like to read/write the onclick handler. Is there a way to get at that. Just trying element.onclick = sss didn't work and neither did element.click = sss Is there a way to do this? Andy- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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: enabled_popup internal error
Just no luck. Still not seeing any popup. roles_page.bottom_delete.click_no_wait# = no popup displayed but if I use roles_page.bottom_delete.click #=== popup comes right up On Mar 5, 10:17 am, Jim Matthews jim_m...@swbell.net wrote: One thing I forgot to mention: someone else got click_no_wait to work by going into IE -Tools - Internet Options...-Advanced and under Security, check the box titled Allow active content to run in files on My Computer. Jim On Mar 5, 9:32 am, Jim Matthews jim_m...@swbell.net wrote: Glad to know that helped. Now you are at the point I am at. There are several of us working to see if we can resolve the problem. It appears that the same Ruby / Watir combination works for some people and does not work for others as far as handling the javascript popups. Because of this, we think there is some system setting that makes the difference rather than it being strictly a Ruby and Watir problem. If you have any insights on this, please share them. I will try to answer some of your questions. First the normal click that brings up the javascript popup is blocking. The script cannot proceed until the popup is dismissed. If the code to dismiss the popup is in the same thread, it stays that way forever (well you know what I mean). The click_no_wait is non blocking, which allows your script to continue with the routine to dismiss the popup. So, the short answer is that just click won't work for something that brings up a popup (I'll add the qualification that it does work if you create a separate thread to click the popup. I only mention this because there some examples floating around that do that. I do not want to lead you too far astray if you find one.) So the preferred method of clicking something that brings up a popup is click_no_wait. Unfortunately, what I am seeing is that the button flashes but no popup ever comes up and the routine to click it times out. I have had a little success with click!. click! is also not blocking. That works one time for me but not the second time in the same script. I think the confusion about the page and page container has to do with confusion over the term page. The cucumber page is not the same exactly the same as the Watir page. Beyond that, I cannot offer much information. Just be aware that although people use the same name for things in different programs, they might not mean the same thing. Try the click! on the button that brings up the popup and see if that works for you (since it sounds like the click_no_wait doesn't work for you) and let us know your results. If you figure anything out about system settings that might affect this, let us know. If I find out anything else for you, I'll post it here. Jim On Mar 5, 8:12 am, andrew.d...@lthree.com wrote: That got me further. Now I have a question about click_no_wait. When I use just 'click', I get a popup with an OK and Cancel button. When I use click_no_wait, I am now not getting any popup. If I use sleep right after click_no_wait, does the browser keep going so I would expect to see a popup? And no, the OK button is not getting clicked to clear the popup. Here is the code. roles_page.roles.row(:name = Test Role).col1_element.click #click on checkbox roles_page.bottom_delete.click_no_wait # shows confirm dialog (only working if I use click) sleep 5 startClicker (OK) # try to click OK button, doesn't work and startclicker is now def startClicker( button_label , waitTime= 9, user_input=nil ) # get a handle if one exists hwnd = nil begin hwnd = SITE.browser.enabled_popup(waitTime) rescue TimeOutException = e #===This exception is always thrown right now #popup not found end if (hwnd) # yes there is a popup puts 'popup found' w = WinClicker.new w.makeWindowActive(hwnd) if ( user_input ) w.setTextValueForFileNameField( hwnd, #{user_input} ) end # OK or whatever the name on the button is puts Trying to click on + button_label w.clickWindowsButton_hwnd( hwnd, button_label ) # # this is just cleanup w=nil else puts No popup found end end On a side note, why is enabled_popup defined as part of PageContainer if it is meant to be called from a browser object only? On Mar 4, 3:21 pm, Jim Matthews jim_m...@swbell.net wrote: OK, too bad you did not include this originally. I think I know what the problem is. At least I see something that is a problem. You have: hwnd = page_container.enabled_popup(waitTime) hwnd belongs to the browser, not the page, so you have to reference the borwser object like: hwnd = $ie.enabled_popup(waitTime) or change $ie to browser, or
[wtr-general] Re: enabled_popup internal error
I was basing my code on example 4. Use click_no_wait on a button I know will cause a popup, and then call enabled_popup. The call from enabled_popup never returns. I can post the entire exception trace if that helps. On Mar 4, 8:26 am, Jim Matthews jim_m...@swbell.net wrote: From your first post, I am not sure how you are trying to use ie.enabled_popup. I assume you are trying to something like what is described on the wiki: http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups I do not know which example you are following. If you take this one for example, require 'watir/contrib/enabled_popup' def popupChecker(text) Timeout::timeout(2)do begin if ie.enabled_popup hwnd = ie.enabled_popup(5) w = WinClicker.new w.makeWindowActive(hwnd) w.clickWindowsButton_hWnd(hwnd,text) end rescue Timeout::Error puts 'No popup existed' end end end The strange thing to me is that the error you show references a Watir frame. A frame would not have an hwnd associated with it directly, so I am not sure how you even got the error. I am trying to use the routine above and am finding that there must be some things on my system that keep it from working all the time. Sometimes it dismisses the popup and sometimes it doesn't. Jim On Mar 4, 5:26 am, andrew.d...@lthree.com wrote: Its not my code that is throwing the error. Here is the code for enabled popup from my watir install. The line generating the error is hwnd_modal, arr = GetWindow.call(hwnd, GW_ENABLEDPOPUP) - hwnd is undefined. module Watir module PageContainer include Win32 def enabled_popup(timeout=4) # Use handle of our parent window to see if we have any currently # enabled popup. hwnd_modal = 0 Waiter.wait_until(timeout) do hwnd_modal, arr = GetWindow.call(hwnd, GW_ENABLEDPOPUP) hwnd_modal 0 end # use hwnd() method to find the IE or Container hwnd (overriden by IE) if hwnd_modal == hwnd() || 0 == hwnd_modal hwnd_modal = nil end hwnd_modal end end end On Mar 3, 1:49 pm, Jim Matthews jim_m...@swbell.net wrote: I thought you were having the same problem I am with popups, but I think yours is different at this point. The window handle is going to be on the browser and not a part of the DOM. You have to get the hwnd off the browser and go from there. Jim On Mar 3, 1:16 pm, andrew.d...@lthree.com wrote: Trying to execute enabled_popup and it is throwing an exception undefined local variable or method `hwnd' for #Watir::Frame: 0x3d7b4d4 I checked the source for enabled_popup and it does seem to have an undeclared variable. Is this working for other people. Working on latest version of watir.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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] enabled_popup internal error
Trying to execute enabled_popup and it is throwing an exception undefined local variable or method `hwnd' for #Watir::Frame: 0x3d7b4d4 I checked the source for enabled_popup and it does seem to have an undeclared variable. Is this working for other people. Working on latest version of watir. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---