[wtr-general] Re: Help with Modal Dialog boxes !!!!
@ Rohan I had cause to revisit this issue after this afternoon suddently having a similar modal window problem, and realise now what you were on about and me telling you irrelevant info. My solution was naturally for attaching to browser windows spawned from a modal, whereas your issue is for attaching to modals themselves. I spotted this via the WATiR tutorial pages, and solved my modal attachment woes (http://jira.openqa.org/browse/WTR-414). It says its an IE8 problem, but I experienced it on IE7. I edited the modal_dialog.rb file in my gems from 'Web Page Dialog' to 'Webpage Dialog' and I could then interrogate the modal using the title. I hope this helps you some more. GJHmf -- 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
Re: [wtr-general] Re: Questiona about Watir in Mac with Firefox 3.6
did you install the mac developer tools ( I cant even think whats its called - xcode??) Its usually on a dvd that came with your mac Paul On Thu, Feb 11, 2010 at 9:51 PM, Moises Siles wrote: > I'm getting the following error when I ran the command > sudo gem install selenium-webdriver > > Building native extensions. This could take a while... > ERROR: Error installing selenium-webdriver: > ERROR: Failed to build gem native extension. > > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby > extconf.rb > mkmf.rb can't find header files for ruby at > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h > > > Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/ffi-0.6.0 > for inspection. > Results logged to > /Library/Ruby/Gems/1.8/gems/ffi-0.6.0/ext/ffi_c/gem_make.out > > > > On Thu, Feb 11, 2010 at 3:57 AM, Željko Filipin < > zeljko.fili...@wa-research.ch> wrote: > >> On Thu, Feb 11, 2010 at 7:26 AM, Moises Siles >> wrote: >> > thanks man, now I'm able to run my test but when I ran the telnet I got >> a connection refused message :P >> >> I risk sounding like a broken record, but looks like you are in jssh hell. >> I would suggest that you try watir-webdriver. It can drive Firefox on Mac: >> >> http://zeljkofilipin.com/2010/01/12/watir-on-webdriver/ >> >> Željko >> -- >> watir.com - community manager >> pledgie.com/campaigns/2982 - donate to Watir >> watirpodcast.com - host >> testingpodcast.com - podcasts on software testing. all of them >> >> -- >> 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 >> > > -- > 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 > -- 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: Measure download time of a file using watir
Is a Download Complete popup actually displayed? If not, then that example won't work. ai.ControlClick("Save As", "", "&Save", "left") and ai.ControlClick("Download complete", "", "Close") provide 2 distinct code points around the download process. If possible, you need to identify a second one (e.g. a Download Complete prompt). Otherwise, maybe something like this (untested): ### ai.ControlSend("Save As", "", "Edit1", file_to_download) ai.ControlClick("Save As", "", "&Save", "left") time_start = Time.now until File.exist?(filename) && File.size(filename) == known_file_size end time_end = Time.now ### Take a look at the File class. It's packed with cool stuff. Hope it helps. On Feb 11, 8:53 pm, Maumita wrote: > Hi, I made the changes as per the suggesstion.Below find my modified > script > But my script gets ended once the file starts downloading. The script > is not handling "ai.WinWait("Download complete", "", 5) > ai.ControlClick("Download complete", "", "Close")" > Please help on this. I am using watir-1.6.2 > > require 'watir' > require 'win32ole' > > $ie = Watir::IE.new > $ie.goto("http://localhost/dportal";) > $ie.image(:name, 'toplogo_nav_04_off').click > $ie.link(:text, 'Hitach product').click > $ie.link(:text, 'File size 220 MB').click_no_wait > > ai = WIN32OLE.new("AutoItX3.Control") > ai.WinWait("File Download", "", 5) > ai.ControlFocus("File Download", "", "&Save") > sleep 1 > ai.ControlClick("File Download", "", "&Save", "left") > ai.WinWait("Save As", "", 5) > sleep 1 > begin_time=Time.now > ai.ControlSend("Save As", "", "Edit1","login.csv") > ai.ControlClick("Save As", "", "&Save", "left") > ai.WinWait("Download complete", "", 5) > ai.ControlClick("Download complete", "", "Close") > end_time=Time.now > p (end_time - begin_time).to_s > > Thanks > Maumita > > On Feb 11, 11:46 pm, orde wrote: > > > > > Is there a Download Complete prompt/popup? If so, you could wrap this > > section of solution #2, and it will give you an approx. download > > time. > > > Otherwise, you might be able to use the File class (e.g. see if the > > downloaded file exists? is the size 220MB?). > > > ### > > begin_time=Time.now > > ai.ControlSend("Save As", "", "Edit1",filepath) > > ai.ControlClick("Save As", "", "&Save", "left") > > ai.WinWait("Download complete", "", 5) > > ai.ControlClick("Download complete", "", "Close") > > end_time=Time.now > > download_time = time_start - time_end > > ### > > > Hope it helps. > > > On Feb 11, 2:20 am, Maumita wrote: > > > > require 'watir' > > > require 'win32ole' > > > $ie = Watir::IE.new > > > $ie.goto("http://localhost/dportal";) > > > $ie.image(:name, 'toplogo_nav_04_off').click > > > $ie.link(:text, 'Hitach product').click > > > $ie.link(:text, 'File size 220 MB').click_no_wait > > > > prompt_message = "Do you want to open or save this file?" > > > window_title = "File Download" > > > save_dialog = WIN32OLE.new("AutoItX3.Control") > > > sleep 1 > > > save_dialog_obtained = > > > save_dialog.WinWaitActive(window_title,prompt_message, 25) > > > save_dialog.ControlFocus(window_title, prompt_message, "&Save") > > > sleep 1 > > > save_dialog.ControlClick(window_title, prompt_message, "&Save") > > > saveas_dialog_obtained = save_dialog.WinWait("Save As", "Save&in", 5) > > > sleep 1 > > > begin_time=Time.now > > > path = File.dirname("D:/ruby/log/").gsub("/" , "\\" )+ "\\" + > > > "login.csv" > > > save_dialog.ControlSend("Save As", "", "Edit1",path) > > > save_dialog.ControlClick("Save As", "Save &in", "&Save") > > > end_time=Time.now > > > download_time = time_start - time_end > > > > But my scripts exist when the file starts downloading. > > > Please help on this.This is urgent for my project to measure the file > > > download time. > > > Is there any other way to do this? > > > > Thanks in advance > > > Maumita > > > > On Feb 11, 2:14 am, orde wrote: > > > > > I've used solution #2 > > > > onhttp://wiki.openqa.org/display/WTR/File+Downloads. > > > > > You should be able to modify that code to get an approximate download > > > > time: > > > > > time_start = Time.now > > > > # code > > > > # code > > > > time_end = Time.now > > > > download_time = time_start - time_end > > > > > Hope it helps. > > > > > orde > > > > > On Feb 10, 1:30 am, Maumita wrote: > > > > > > Hi, > > > > > > Is this possible to write a watir script that should download a file > > > > > from website to locally and also to measure how long it takes to > > > > > download the file. > > > > > This is a requirement in my project. The main idea is to measure the > > > > > download time of a file. > > > > > Please suggest if there is any way to do this. > > > > > Thanks in advance. > > > > > > Maumita -- 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 fol
Re: [wtr-general] Re: watir install fubared by win32-api-1.4.6 ??
It should work fine now, Dan just uploaded an x86-mswin32 precompiled binary. -c On Wed, Feb 10, 2010 at 5:41 PM, Charley Baker wrote: > There's something wrong with the current gem requires and win32-api. I'll > check into it. Use the hack below to get at the previous version until I > have a chance to fix this. > > -c > > > > On Wed, Feb 10, 2010 at 11:21 AM, mellissa > wrote: > >> Hey Alan, >> >> Thanks for posting this workaround. I was experiencing a similar issue >> with a fresh install but rolling back the win32 api fixed it. >> >> My errors posted below, but in the same vein: >> >> --- >> C:\>gem install watir >> Building native extensions. This could take a while... >> ERROR: Error installing watir: >>ERROR: Failed to build gem native extension. >> >> C:/Ruby/bin/ruby.exe extconf.rb >> checking for strncpy_s()... no >> creating Makefile >> >> nmake >> >> Microsoft (R) Program Maintenance Utility Version 1.50 >> Copyright (c) Microsoft Corp 1988-94. All rights reserved. >> >>cl -nologo -I. -I. -IC:/Ruby/lib/ruby/1.8/i386-mswin32 -I. -MD >> -Zi -O2b2 >> xg- -G6 -c -Tcwin32/api.c >> 'cl' is not recognized as an internal or external command, >> operable program or batch file. >> NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code >> '0x1' >> Stop. >> >> >> Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.8/gems/ >> win32-api-1.4. >> 6 for inspection. >> Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/win32-api-1.4.6/ext/ >> gem_make.out >> --- >> >> Thanks again! >> >> mellissa >> >> On Feb 9, 3:04 pm, Alan Baird wrote: >> > All - >> > >> > Maybe I'm the only one that is having this problem but as I was trying >> to install Watir today from a fresh install (using ruby 1.8.6 and >> downloading the rubygems installer), I get the following message: >> > >> > Y:\abaird\ruby_install\rubygems-1.3.5\rubygems-1.3.5>gem install watir >> > Building native extensions. This could take a while... >> > ERROR: Error installing watir: >> > ERROR: Failed to build gem native extension. >> > >> > c:/ruby/bin/ruby.exe extconf.rb >> > checking for strncpy_s()... no >> > creating Makefile >> > >> > nmake >> > 'nmake' is not recognized as an internal or external command, >> > operable program or batch file. >> > >> > Gem files will remain installed in >> c:/ruby/lib/ruby/gems/1.8/gems/win32-api-1.4.6 for inspection. >> > Results logged to >> c:/ruby/lib/ruby/gems/1.8/gems/win32-api-1.4.6/ext/gem_make.out >> > >> > It looks like according to this: >> http://gems.rubyforge.org/gems/win32-apithat there might be some version >> conflict in the recent versions. >> > >> > However, if you do a 'gem install win32-api -v 1.4.5' followed by 'gem >> install watir' everything should work out fine. >> > >> > Also, can anyone tell me why watir has a dependency on gemcutter? I >> thought that maybe it was because watir was hosted on GitHub, but I can't >> install it when GitHub is my only gem source so maybe it's for another gem? >> > >> > Just curious. >> > >> > Alan >> > >> > This email message and any attachments are for the sole use of the >> intended recipients and may contain proprietary and/or confidential >> information which may be privileged or otherwise protected from disclosure. >> Any unauthorized review, use, disclosure or distribution is prohibited. If >> you are not an intended recipient, please contact the sender by reply email >> and destroy the original message and any copies of the message as well as >> any attachments to the original message. >> >> -- >> 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 >> > > -- 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] Is it possible to extend the Firefox class?
Hello, In the past I have attempted to save some typing by extinding the IE class so that I could create methods specific to my AUT, e.g.: require 'watir' include Watir class Salesforce < IE def start self.goto("http://test.salesforce.com";) end def login(username, password) self.text_field(:name, "username").set(username) self.text_field(:name, "password").set(password) self.button(:id, "Login").click end end This always worked just fine for me, but now I am trying to do the same exact thing with the Firefox class, but when it executes the line "self.text_field(:name, "username").set(username)", (called from a test script that is using a "Salesforce" object as the browser) I get a runtime error: 1) Error: test_start(TestLogin): NoMethodError: undefined method `element_name' for # /var/lib/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/element.rb: 276:in `locate_tagged_element' /var/lib/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/elements/ input_element.rb:22:in `locate' /var/lib/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/element.rb: 964:in `exists?' /var/lib/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/element.rb: 905:in `assert_exists' /var/lib/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/elements/ text_field.rb:149:in `set' test_login.rb:17:in `test_start' "self.goto" works fine but once I access those text fields it throws an error. Am I doing something wrong, or is it just not possible to extend the Firefox class is this way? Thanks, Brian -- 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
Re: [wtr-general] Is it possible to extend the Firefox class?
I remember similar problems during some experiments I was attempting a while back. Another option is to simply reopen the browser class you want to extend, and start adding your own methods: class FireWatir::Firefox def your_custom_method Needless to say, if the Watir::IE / FireWatir::Firefox class and module structure ever changes, this code will break. How badly depends on how extensive the future changes are, I guess. :) But for what you are trying to do it might work. Also, one must be careful not to step on any methods that already exist. You can extend existing methods without much trouble, but the code gets a little more complicated (especially when extending class methods instead of instance methods). Some searches for info on Ruby "alias chaining" might help if you want to extend existing methods. Thanks Bill On Fri, Feb 12, 2010 at 12:16 PM, Brian Tomlin wrote: > Hello, > > In the past I have attempted to save some typing by extinding the IE > class so that I could create methods specific to my AUT, e.g.: > > require 'watir' > include Watir > > >class Salesforce < IE >def start >self.goto("http://test.salesforce.com";) >end > >def login(username, password) >self.text_field(:name, "username").set(username) >self.text_field(:name, "password").set(password) >self.button(:id, "Login").click >end >end > > This always worked just fine for me, but now I am trying to do the > same exact thing with the Firefox class, > but when it executes the line "self.text_field(:name, > "username").set(username)", (called from a test script that is using a > "Salesforce" object as the browser) I get a runtime error: > > 1) Error: > test_start(TestLogin): > NoMethodError: undefined method `element_name' for # 0xb7209da8> >/var/lib/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/element.rb: > 276:in `locate_tagged_element' >/var/lib/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/elements/ > input_element.rb:22:in `locate' >/var/lib/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/element.rb: > 964:in `exists?' >/var/lib/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/element.rb: > 905:in `assert_exists' >/var/lib/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/elements/ > text_field.rb:149:in `set' >test_login.rb:17:in `test_start' > > > "self.goto" works fine but once I access those text fields it throws > an error. > > Am I doing something wrong, or is it just not possible to extend the > Firefox class is this way? > > Thanks, > Brian > > > -- > 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 > -- 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] Having trouble navigating Frames
I've been reading the previous posts, but can't seem to grasp the concept of traversing through frames to click on a link. I have the following HTML and would like to use Watir to click on the 'New Search' image button. I've been trying but can't seem to find the link to click on it. < frameset border="0" framespacing ="0" frameborder="0 " rows="33,* " > < frame scrolling ="no" noresize="noresize" src="TopContent.asp" name="TopContent">
[wtr-general] Re: Having trouble navigating Frames
Hi! If this is a typical frames implementation, you just need to specify which frame your link is in. You can find out what frames are available in irb with the show_frames method: browser.show_frames I'm having trouble telling from the HTML, but it looks like 'New Search' is a span. If that's the case, this should work: browser.frame(:name, 'TopContent').span(:text, 'New Search').click Hope this helps! -Tiffany On Feb 12, 3:29 pm, RansomEli wrote: > I've been reading the previous posts, but can't seem to grasp the > concept of traversing through frames to click on a link. I have the > following HTML and would like to use Watir to click on the 'New > Search' image button. I've been trying but can't seem to find the > link to click on it. > > < frameset border="0" framespacing ="0" frameborder="0 " rows="33,* " > > < frame scrolling ="no" noresize="noresize" > src="TopContent.asp" name="TopContent"> > > > >