From bpettichord at gmail.com Wed Aug 19 10:14:42 2009 From: bpettichord at gmail.com (Bret Pettichord) Date: Wed, 19 Aug 2009 09:14:42 -0500 Subject: [Wtr-development] Fwd: Embedded IE automation using watir In-Reply-To: References: Message-ID: I just took a quick look at this, but I think this is something that we've had several requests for. Bret ---------- Forwarded message ---------- From: Basavana Gowda K S Date: Wed, Aug 19, 2009 at 7:56 AM Subject: Embedded IE automation using watir To: bpettichord at gmail.com, zeljko.filipin at wa-research.ch, alister.scott at gmail.com Cc: basavana.gowda at corp.aol.com Hi Bret/Zeljko Filipin/Alister , I work for AOL winamp player team, we had a requirement of testing pages displayed under browser embedded inside the player.This is priority requirement for us. We know that one of the limitation of watir tool is that, *it does not support attaching to IE window when it runs under a service* .So, based on the inputs/help from ruby forums (*Park Heesob provided the implementation of the methods based on my research, thanks a ton to him, saved my time*), i tried implementing/integrating attach method which can work with embedded browser, I thought of reviewing the code with you, so that it could be helpful for you to include it in the upcoming releases of watir. *Procedure: *Get Embedded IE handle -> get HTMLDocument2 ptr (Win32ole) -> get WebBrowser2 ( Win32ole) object -> Watir object Find the attached rb file having the implementation of the same. Sample code used with winamp: *require 'watir' require 'C:/embedded_ie'* * # Invoke winamp Winamp.invoke()* * # Goto online services web page and get the browser instance $library.selectTreeItem("Online Services")* * @@browser = Watir::IE.attach_embedded("Main Window", :classnameNN, "Internet Explorer_Server1")* * @@brower.link(:text, 'ONLINE SERVICES').click()* * Attach method syntax:* * Watir::IE.attach_embedded(parent, how, what) * parent -> parent window control name Ex: "Main Window" is winamp here how -> :classnameNN or :hnd embedded ie window control or handle property type , Ex: :ClassnameNN is used in the above example what -> :classnameNN or :hnd embedded ie window control or handle property value Ex: ie window control "Internet Explorer_Server1" , "Internet Explorer_Server2" etc .. * Advantage: * We can manipulate pages displayed inside the embedded instance of IE. One more small request , teams here at AOL are widely using watir tool, Alister Scott could you please include us under watir users Revert back to me for any information on this. Thanks -B -- Bret Pettichord Lead Developer, Watir, www.watir.com Blog, www.io.com/~wazmo/blog Twitter, www.twitter.com/bpettichord -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: embedded_ie.rb Type: application/octet-stream Size: 4555 bytes Desc: not available URL: From charley.baker at gmail.com Wed Aug 19 14:04:13 2009 From: charley.baker at gmail.com (Charley Baker) Date: Wed, 19 Aug 2009 12:04:13 -0600 Subject: [Wtr-development] Fwd: Embedded IE automation using watir In-Reply-To: References: Message-ID: Interesting stuff. Park is a huge contributor on the ruby win32 projects, and looking as the code to implement this makes me go blind. I think it's a good idea to add this feature to the core codebase with two caveats. The code to implement this is rather challenging with a huge amount of hex values values for something being passed in and out to windows api calls; it would be nice to either invite Park to help out if people do have problems, at least get some understanding of what's going on and/or someone to take over this particular area. I have a fair amount of Windows client programming experience, and can hack at this if need be, but I'd rather have someone who knows this better or at the very least, work with Park on understanding and being able to maintain this code. An addendum is that I have no need for this in my applications, so it's better suited for someone who has a stronger motivation to fix problems as they arise. The second caveat is the same with a lot of contributions, there are no tests submitted with the code. In order for this to be accepted into the core, that's a requirement. We certainly could vette this in contrib as a useful feature that's basically unsupported, but that invites additional traffic with questions onto the mailing list. Acceptable possibly and likely to be low traffic at that. However, contrib is somewhat of a backlog which I'd rather not see grow too large. Anyhow those are thoughts off the top of my head. Does anyone have another opinion to add? Charley Baker Lead Developer, Watir, http://wtr.rubyforge.org On Wed, Aug 19, 2009 at 8:14 AM, Bret Pettichord wrote: > I just took a quick look at this, but I think this is something that we've > had several requests for. > > Bret > > ---------- Forwarded message ---------- > From: Basavana Gowda K S > Date: Wed, Aug 19, 2009 at 7:56 AM > Subject: Embedded IE automation using watir > To: bpettichord at gmail.com, zeljko.filipin at wa-research.ch, > alister.scott at gmail.com > Cc: basavana.gowda at corp.aol.com > > > Hi Bret/Zeljko Filipin/Alister , > > I work for AOL winamp player team, we had a requirement of testing pages > displayed under browser embedded inside the player.This is priority > requirement for us. > > We know that one of the limitation of watir tool is that, *it does not > support attaching to IE window when it runs under a service* .So, based on > the inputs/help from ruby forums (*Park Heesob provided the implementation > of the methods based on my research, thanks a ton to him, saved my time*), > i tried implementing/integrating attach method which can work with embedded > browser, > > I thought of reviewing the code with you, so that it could be helpful for > you to include it in the upcoming releases of watir. > > *Procedure: > *Get Embedded IE handle -> get HTMLDocument2 ptr (Win32ole) -> get > WebBrowser2 ( Win32ole) object -> Watir object > > Find the attached rb file having the implementation of the same. > > Sample code used with winamp: > > *require 'watir' > require 'C:/embedded_ie'* > > * # Invoke winamp > Winamp.invoke()* > > * # Goto online services web page and get the browser instance > $library.selectTreeItem("Online Services")* > > * @@browser = Watir::IE.attach_embedded("Main Window", :classnameNN, > "Internet Explorer_Server1")* > > * @@brower.link(:text, 'ONLINE SERVICES').click()* > > * Attach method syntax:* > > * Watir::IE.attach_embedded(parent, how, what) > * parent -> parent window control name Ex: "Main Window" is winamp > here > how -> :classnameNN or :hnd embedded ie window control or handle > property type , Ex: :ClassnameNN is used in the above example > what -> :classnameNN or :hnd embedded ie window control or handle > property value Ex: ie window control "Internet Explorer_Server1" , "Internet > Explorer_Server2" etc .. > > * Advantage: > * We can manipulate pages displayed inside the embedded instance of IE. > > One more small request , teams here at AOL are widely using watir tool, > Alister Scott could you please include us under watir users > > Revert back to me for any information on this. > > Thanks > -B > > > > -- > Bret Pettichord > Lead Developer, Watir, www.watir.com > > Blog, www.io.com/~wazmo/blog > Twitter, www.twitter.com/bpettichord > > > _______________________________________________ > Wtr-development mailing list > Wtr-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-development > -------------- next part -------------- An HTML attachment was scrubbed... URL: