tag:blogger.com,1999:blog-284600789737488130.post8071923906185217335..comments2024-02-07T02:22:20.642-05:00Comments on Ruby on Windows: Automating Internet Explorer with Ruby: WatirDavid Mullethttp://www.blogger.com/profile/05597492688893461137noreply@blogger.comBlogger20125tag:blogger.com,1999:blog-284600789737488130.post-18575735401002784032013-11-13T05:47:42.278-05:002013-11-13T05:47:42.278-05:00Hi
while following the above commands got the fo...Hi <br /><br />while following the above commands got the following error, Can anyone help me regarding this issue.<br />C:\Windows\System32>gem install watir<br />Successfully installed watir-5.0.0<br />Parsing documentation for watir-5.0.0<br />Done installing documentation for watir after 0 seconds<br />1 gem installed<br /><br />C:\Windows\System32>irb<br />DL is deprecated, please use Fiddle<br />irb(main):001:0> require 'watir'<br />=> true<br />irb(main):002:0> ie = Watir::IE.new<br />NameError: uninitialized constant Watir::IE<br /> from (irb):2<br /> from C:/Ruby200-x64/bin/irb:12:in `'<br />irb(main):003:0><br /><br /><br />Anonymoushttps://www.blogger.com/profile/12339959099158683664noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-861068735393020922009-05-24T20:26:27.492-05:002009-05-24T20:26:27.492-05:00Hey. Anyway we can open / close new tabs in IE usi...Hey. Anyway we can open / close new tabs in IE using Watir?Unknownhttps://www.blogger.com/profile/03157972397856235755noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-6233949439310272102009-04-29T14:59:00.000-05:002009-04-29T14:59:00.000-05:00Hey David. I'm brand new to using win32ole and aut...Hey David. I'm brand new to using win32ole and automation objects. I'm trying to get watir to work with an embedded browser but having no luck. Passing the hwnd of the embedded browser to the Watir::IE.attach does not work because watir will iterate over the open windows from <br />WIN32OLE.new('Shell.Application')<br />and check if one of those hwnd matches the one you passed. However my application is not a internet explorer window so it doesn't show up in that list. <br />Here is the each method watir uses to find IE instances:<br /><br />def self.each<br /> shell = WIN32OLE.new('Shell.Application')<br /> shell.Windows.each do |window|<br /> next unless (window.path =~ /Internet Explorer/ rescue false)<br /> next unless (hwnd = window.hwnd rescue false)<br /> ie = IE.bind(window)<br /> ie.hwnd = hwnd<br /> yield ie<br /> end<br /> end<br /><br />So basically what i need to do is get the corresponding window and bind it using IE.bind, and then I should be able to use watir like normal. This is proving challenging. I have no trouble getting the hwnd of the application i'm using, getting the hwnd of the embedded browser is easy too.. Unfortunately I don't know how to get the corresponding com/ole object (the terminology is killing a newbie like me).<br />I did find that autoit's IE.au3 has a function called: __IEControlGetObjFromHWND<br />which takes a hwnd and returns the control.. I don't think i can call that function from ruby (any ideas). Its pretty complicated and I haven't been able to figure out how to write it in ruby either.<br /><br />If your curious the source for IE.au3 is here:<br />http://www.therks.com/autoit/install/Include/IE.au3<br /><br />Any help would be greatly appreciatedUnknownhttps://www.blogger.com/profile/10705430305036269796noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-85970349461382844542008-01-02T13:31:00.000-05:002008-01-02T13:31:00.000-05:00I haven't seen mention of the Internet Explorer De...I haven't seen mention of the Internet Explorer Developer Toolbar. This allows you to examine the gory details of web pages. Very helpful when writing Watir apps. <BR/><BR/>http://www.microsoft.com/downloads/details.aspx?familyid=e59c3964-672d-4511-bb3e-2d5e1db91038&displaylang=en<BR/><BR/>..StrastAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-21044761121470128642007-12-28T02:40:00.000-05:002007-12-28T02:40:00.000-05:00automating Outlook webaccess:I am trying to automa...automating Outlook webaccess:<BR/><BR/>I am trying to automate some of the OWA cases like (send mail, receive mail,...etc..). I am accessing OWA through IE browser. When we are accessing OWA through IE browser, I can't find object Id's of OWA in view source page. Please let me know if anyone has any ideas on how to do this.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-87454493678769693742007-12-27T06:06:00.000-05:002007-12-27T06:06:00.000-05:00This comment has been removed by a blog administrator.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-8961617067860450992007-10-29T20:46:00.000-05:002007-10-29T20:46:00.000-05:00@Mariovsky-It looks like your question has since b...@Mariovsky-<BR/><BR/>It looks like your question has since been answered on <A HREF="http://www.ruby-forum.com/topic/129067#new" REL="nofollow">the Ruby forum</A>.<BR/><BR/>DavidDavid Mullethttps://www.blogger.com/profile/05597492688893461137noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-42982793364937161332007-10-23T12:01:00.000-05:002007-10-23T12:01:00.000-05:00I'm trying to do this:----------------------------...I'm trying to do this:<BR/><BR/>-----------------------------<BR/>require 'Watir'<BR/><BR/>class Navigator < Watir::IE<BR/> def initialize(maxim)<BR/> @maxim=maxim<BR/> @iex=Watir::IE.new<BR/> end<BR/> def go(url)<BR/> @iex.goto(url)<BR/> if @maxim==1 then<BR/> @iex.maximize()<BR/> end<BR/> end<BR/>end<BR/><BR/>naveg=Navigator.new(1)<BR/>naveg.go("http://www.google.es")<BR/><BR/>puts naveg.url<BR/>--------------------------------<BR/>I want my 'naveg' object can display the properties of wakir. What am I doing wrong?Mario Ruizhttps://www.blogger.com/profile/06846664205317641135noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-76012873565640714072007-10-18T20:28:00.000-05:002007-10-18T20:28:00.000-05:00@Ajeet:You can check the contents of ie.title or i...@Ajeet:<BR/><BR/>You can check the contents of ie.title or ie.text. Examples:<BR/><BR/>if ie.title =~ /Cannot find server/<BR/><BR/>if ie.text=~ /cannot be displayed/<BR/><BR/>DavidDavid Mullethttps://www.blogger.com/profile/05597492688893461137noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-36536142304436877362007-10-10T04:26:00.000-05:002007-10-10T04:26:00.000-05:00Can i read the Error messages coming on the browse...Can i read the Error messages coming on the browser using ruby.<BR/>If possible please tell me.Unknownhttps://www.blogger.com/profile/07877712724168408611noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-13698747752089649192007-07-29T21:35:00.000-05:002007-07-29T21:35:00.000-05:00I tried to use the property ie.visible = false and...I tried to use the property ie.visible = false and got the message that the method dont exist. Than using $HIDE_IE=true it works. So shalini, try to set it to false: $HIDE_IE=falseUnknownhttps://www.blogger.com/profile/13372059512465028134noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-59667716333954825462007-07-13T01:48:00.000-05:002007-07-13T01:48:00.000-05:00watir-1[1].5.1.1192.gem automatically hide interne...watir-1[1].5.1.1192.gem automatically hide internet explorer.If i don't want to hide this.Then what should i do??<BR/>Please tell..Shalinihttps://www.blogger.com/profile/18058778022848384960noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-59827354854650585712007-06-29T18:35:00.000-05:002007-06-29T18:35:00.000-05:00@Charles:yes, it is possible, using the IE.attach ...@Charles:<BR/><BR/>yes, it is possible, using the <B>IE.attach</B> method:<BR/><BR/>ie = Watir::IE.attach(:title, 'Ruby on Windows')<BR/><BR/> - OR -<BR/><BR/>ie = Watir::IE.attach(:url, 'http://rubyonwindows.blogspot.com')<BR/><BR/>Then call the <B>IE.refresh</B> method:<BR/><BR/>ie.refresh<BR/><BR/>DavidDavid Mullethttps://www.blogger.com/profile/05597492688893461137noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-39441723345735749852007-06-29T11:58:00.000-05:002007-06-29T11:58:00.000-05:00Do you know if it is possible to take control of a...Do you know if it is possible to take control of an existing window and refresh it using Watir? I've been having a look at Firewatir also (for controlling Firefox), but I can't see a way of attaching to an already open window.Charles Roperhttps://www.blogger.com/profile/04699427051468243195noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-53004781055706508202007-05-11T12:19:00.000-05:002007-05-11T12:19:00.000-05:00Sorry, one more thing...I performed a word search ...Sorry, one more thing...I performed a word search for "visible" in the rdoc and found only one instance, which was for the -b command prompt option for making the browser invisible. From what I can see, there doesn't appear to be a "visible" method defined in watir. Sure enough: <BR/><BR/>ie = Watir::IE.new => true<BR/>ie.visible = false => method 'visible' not found<BR/><BR/>Am I missing something?Walkerhttps://www.blogger.com/profile/14152234200831316723noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-76946290972983273002007-05-11T12:13:00.000-05:002007-05-11T12:13:00.000-05:00Searched the rdoc, and I can't find a way to conne...Searched the rdoc, and I can't find a way to connect to an already open instance of IE. It seems to me that win32ole can do this. Any explanation?Walkerhttps://www.blogger.com/profile/14152234200831316723noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-65656936044851199512007-05-06T14:43:00.000-05:002007-05-06T14:43:00.000-05:00I am the one who asked if you could do automating ...I am the one who asked if you could do automating IE with ruby.<BR/><BR/>Yes, I agree that Watir is easier than using win32ole directly. In fact, I use Watir for web scraping.<BR/>Normally, I go to a webpage and download the contents of a table.<BR/>For certain webpages, the browser fails to signal Watir that the page has been loaded, and the script just hangs.<BR/><BR/>My workaround was to add a goto_and_wait method to the IE class.<BR/><BR/>Now I think that knowing the IE wethods available through win32ole would be very benificial to understand Watir better. Sometimes it might better to use winole so that an application might no need to require watir and all the watir requires. This way your script does not get bloated with methods that are not used.<BR/><BR/>Thank you<BR/><BR/>Bernard Kenik<BR/>renard@nc.rr.comAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-5689927300784652702007-05-04T20:55:00.000-05:002007-05-04T20:55:00.000-05:00bret mentioned the rdoc (thanks, bret!), for which...bret mentioned the rdoc (thanks, bret!), for which I forgot to include a link in my article. <A HREF="http://wtr.rubyforge.org/rdoc/index.html" REL="nofollow">Here it is</A>.David Mullethttps://www.blogger.com/profile/05597492688893461137noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-2547014977806948302007-05-04T17:49:00.000-05:002007-05-04T17:49:00.000-05:00To hide an existing browser, use ie.visible = fals...To hide an existing browser, use <B>ie.visible = false</B>. You can find this and other handy methods for Watir in the rdoc.Bret Pettichordhttps://www.blogger.com/profile/08902894149836157023noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-10029412491633631872007-05-04T11:09:00.000-05:002007-05-04T11:09:00.000-05:00Wow, just yesterday I had the thought, I should wr...Wow, just yesterday I had the thought, I should write David and ask him about IE automation. Your blog is coming at the perfect time.<BR/><BR/>I had trouble getting gem install to work through my work proxy, but it was easy to download the watir.gem file from their site, and install it with "gem install watir.gem".<BR/><BR/>I also had to search to figure out how to hide the ie window. You can set the hide variable to true: $HIDE_IE=true, and when you connect to a new Watir::IE instance, it will be hidden. I could not figure out how to hide/unhide a window that's already open, like you can with the win32ole .visible call.<BR/><BR/>I experimented with win32ole for IE automation. From the perspective of the basics, watir does the same things as win32ole, and you don't have to keep track the whole DHTML (DOM) heirarchy.<BR/><BR/>Thanks for this tip.Walkerhttps://www.blogger.com/profile/14152234200831316723noreply@blogger.com