Re: [Wtr-general]
FYI combo = ie.ie.document.getElementById("id").object combo.SetTextValue("value") - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=3510&messageID=9955#9955 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general]
I couldn't find anything in the archives and on web. Has anyone used watir to interact with one of these controls? or direct through the DOM/javascript ? - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=3510&messageID=9844#9844 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Attaching to windows problem
Found the cause of my problem.. added some extra puts lines to watir.rb _find function def self._find(how, what) shell = WIN32OLE.new("Shell.Application") ieTemp = nil shell.Windows.each do |window| puts window.locationname puts "location url" puts window.locationURL puts "window path" puts window.path #next unless (window.path =~ /Internet Explorer/ rescue false) next unless (window.path =~ /WINDOWS/ rescue false) # this works window.path on my machine is putting out C:\WINDOWS\ and not matching on /Internet Explorer/ Now over to smarter minds than mine to explain where and how the value of window.path is sourced from .. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Neri, MarcoSent: Wednesday, 2 August 2006 10:29To: wtr-general@rubyforge.orgSubject: Re: [Wtr-general] Attaching to windows problem I'm having similar issues. running watir 1.5.1.1065 ruby 1.8.2 win xp sp2 error trace 1) Error:testLoadAuditHome(TC_testLoadAuditHome):Watir::Exception::NoMatchingWindowFoundException: Unable to locate a window with title of (?-mix:Audit) c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1065/./watir.rb:1439:in `attach_browser_window' c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1065/./watir.rb:1314:in `attach_init' c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1065/./watir.rb:1307:in `attach' ./Modules\ModuleBrowser.rb:8:in `startBrowser' From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Attebery, BillSent: Friday, 23 June 2006 03:33To: wtr-general@rubyforge.orgSubject: Re: [Wtr-general] Attaching to windows problem I'm using Windows XP - SP2 -- more precisely from About Windows Version 5.1 (Build 2600.xpsp_sp2_gdr.050301-1519 : Service Pack 2) and Ruby version: 1.8.2 (I was once under the impression that this was required for watir and haven't had the need to upgrade) Note: I had not installed Watir from a gem, obviously when I did it put it in the gems directories. I had watir files in the C:\ruby\lib\ruby\site_ruby\1.8 directory so I moved the watir.rb and watir folder from here to another location out of my path to make sure it called the right watir files -- did I miss anything here by chance? The error messages refer to watir 1.5 so it seems it's using the correct version. Just wondering, as I said I haven't done this before. -- There have been a lot of changes in this code in 1.5 and this code is very sensitive to environment.What version of Windows and Ruby are you using? Bret The content contained in this electronic message is not intended toconstitute formation of a contract binding TWTC. TWTC will becontractually bound only upon execution, by an authorized officer, ofa contract including agreed terms and conditions or by expressapplication of its tariffs.This message is intended only for the use of the individual or entityto which it is addressed. If the reader of this message is not theintended recipient, or the employee or agent responsible fordelivering the message to the intended recipient, you are herebynotified that any dissemination, distribution or copying of thismessage is strictly prohibited. If you have received thiscommunication in error, please notify us immediately by replying tothe sender of this E-Mail or by telephone. === The information contained in this email and any files attached may be confidential information to the intended recipient and may be the subject of legal professional privilege or public interest immunity. If you are not the intended recipient, any use, disclosure or copying is unauthorised. If you have received this document in error please telephone 1300 307 082 *** This footnote also confirms that this email message has been swept for the presence of computer viruses. *** === The information contained in this email and any files attached may be confidential information to the intended recipient and may be the subject of legal professional privilege or public interest immunity. If you are not the intended recipient, any use, disclosure or copying is unauthorised. If you have received this document in error please telephone 1300 307 082 *** This footnote also confirms that this email message has been swept for the presence of computer viruses. *** ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wt
Re: [Wtr-general] Attaching to windows problem
I'm having similar issues. running watir 1.5.1.1065 ruby 1.8.2 win xp sp2 error trace 1) Error:testLoadAuditHome(TC_testLoadAuditHome):Watir::Exception::NoMatchingWindowFoundException: Unable to locate a window with title of (?-mix:Audit) c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1065/./watir.rb:1439:in `attach_browser_window' c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1065/./watir.rb:1314:in `attach_init' c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1065/./watir.rb:1307:in `attach' ./Modules\ModuleBrowser.rb:8:in `startBrowser' From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Attebery, BillSent: Friday, 23 June 2006 03:33To: wtr-general@rubyforge.orgSubject: Re: [Wtr-general] Attaching to windows problem I'm using Windows XP - SP2 -- more precisely from About Windows Version 5.1 (Build 2600.xpsp_sp2_gdr.050301-1519 : Service Pack 2) and Ruby version: 1.8.2 (I was once under the impression that this was required for watir and haven't had the need to upgrade) Note: I had not installed Watir from a gem, obviously when I did it put it in the gems directories. I had watir files in the C:\ruby\lib\ruby\site_ruby\1.8 directory so I moved the watir.rb and watir folder from here to another location out of my path to make sure it called the right watir files -- did I miss anything here by chance? The error messages refer to watir 1.5 so it seems it's using the correct version. Just wondering, as I said I haven't done this before. -- There have been a lot of changes in this code in 1.5 and this code is very sensitive to environment.What version of Windows and Ruby are you using? Bret The content contained in this electronic message is not intended toconstitute formation of a contract binding TWTC. TWTC will becontractually bound only upon execution, by an authorized officer, ofa contract including agreed terms and conditions or by expressapplication of its tariffs.This message is intended only for the use of the individual or entityto which it is addressed. If the reader of this message is not theintended recipient, or the employee or agent responsible fordelivering the message to the intended recipient, you are herebynotified that any dissemination, distribution or copying of thismessage is strictly prohibited. If you have received thiscommunication in error, please notify us immediately by replying tothe sender of this E-Mail or by telephone. === The information contained in this email and any files attached may be confidential information to the intended recipient and may be the subject of legal professional privilege or public interest immunity. If you are not the intended recipient, any use, disclosure or copying is unauthorised. If you have received this document in error please telephone 1300 307 082 *** This footnote also confirms that this email message has been swept for the presence of computer viruses. *** ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] launch broswer as another user ?
Hi has anyone had to come up with a way of launching an instance of ie from within a script but run as another user context? I tried using cpau and I can launch a browser using a ruby script. I then run that script using cpau -u -p -ex "cmd /K \"launchbrowser.rb "" -enc -file launchbrowser.job cpau -dec -file launchbrowser.job whilst this works fine to run the script standalone when I try to run this script from within a testcase using puts("Foo1") exec "cpau -dec -file launchbrowser.job" puts("Foo2") the browser launches but the testcase dosen't run through to completition drops out to cmd prompt as soon as the exec finishes. the plan was then to use ie.attach to attach to this browser window I'm hoping someone else has an easier / better idea to do this sort of thing? - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=3171&messageID=8712#8712 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] modal dialog support for dialogs launched from within a table ?
Hi I'm using v 1.5.1.1017 I'm clicking on a link in a table which launches a modal dialog. t[count][0].link(:text, "Remove").click_no_wait # m = @ie.modal_dialog(:title, 'Confirmation') m.frame('main').button(:text, 'Yes').click Error is thrown ( note line numbers slightly out of synch as I've added puts calls into Watir ) 1) Error: testSAAddGroup(TC_testSAAddUserToGroup): NoMethodError: undefined method `eval_in_spawned_process' for # c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1017/./watir.rb:2396:in `click_no _wait' C:/visual studio projects/VictoriaPolice/LEAPAuditTests/SAAddGroup.rb:191:in `removeGroup' C:/visual studio projects/VictoriaPolice/LEAPAuditTests/SAAddGroup.rb:237:in `testSAAddGroup' The def for click no wait def click_no_wait assert_exists assert_enabled highlight(:set) object = "#{self.class}.new(self, [EMAIL PROTECTED], [EMAIL PROTECTED])" # currently only defined when @container is IE: @container.eval_in_spawned_process(object + ".click") highlight(:clear) end What is the implication of this? That unless the container is IE ( not a table ) then cannot use click_no_wait and consequently can't use modal dialogs launched from within a table ? Marco === The information contained in this email and any files attached may be confidential information to the intended recipient and may be the subject of legal professional privilege or public interest immunity. If you are not the intended recipient, any use, disclosure or copying is unauthorised. If you have received this document in error please telephone 1300 307 082 *** This footnote also confirms that this email message has been swept for the presence of computer viruses. *** ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] xpath - which html checker to use?
Hey Angrez I sorted my problem. View src in ie dosen't reveal the true src of what is in the DOM. Using web accesibility toolbar plugin in ie -> source -> view generated source. I found the src of my div=test tag which wasn't showing up in the standard ie view src. had one of the developers change this to div id=test and now it's parsing ok. Marco From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Angrez SinghSent: Monday, 5 June 2006 22:39To: wtr-general@rubyforge.orgSubject: Re: [Wtr-general] xpath - which html checker to use? Hi Marco,Could you please send the HTML source so that we can have more detalied look into it?Regards,Angrez On 6/5/06, Marco Neri < [EMAIL PROTECTED]> wrote: I'm using watir 1.5.1.1017 rexml 3.1.4 ( I have not copied any files out of this distrubution ) I'm trying to use an xpath query in a test and I'm running into a parse error ( here's incomplete trace ). 1) Error:test_rexmltest(TC_rexmltest):REXML::ParseException: #Line:Position:Last 80 unconsumed characters: htmlSource ="\n\n" htmlSource = html_source(document.body,htmlSource," ") htmlSource += "\n\n" My problem has 2 parts. 1. why is div="test" written into the output yet when I check the original src in the browser there is no tag div="test". 2. If I modify the watir.rb src and bypass the call to (document.body,htmlSource," ") by using a diff call (ie.ie.parent.document.body OR i use a filestream to read in a saved copy of the html src for the page ) I don't have the div="test' error but I still end up with other parse errors. I know these must be down to malformed html. but.. when I run the original src html through either HTML tidy or Simpletidy it reports warnings but not errors. The parser in rexml must be more strict? Which validator should I use to independently verify the html so that it's inline with what rexml parser expects? thanks Marco ___Wtr-general mailing listWtr-general@rubyforge.orghttp://rubyforge.org/mailman/listinfo/wtr-general === The information contained in this email and any files attached may be confidential information to the intended recipient and may be the subject of legal professional privilege or public interest immunity. If you are not the intended recipient, any use, disclosure or copying is unauthorised. If you have received this document in error please telephone 1300 307 082 *** This footnote also confirms that this email message has been swept for the presence of computer viruses. *** ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] xpath - which html checker to use?
I'm using watir 1.5.1.1017 rexml 3.1.4 ( I have not copied any files out of this distrubution ) I'm trying to use an xpath query in a test and I'm running into a parse error ( here's incomplete trace ). 1) Error:test_rexmltest(TC_rexmltest):REXML::ParseException: #Line:Position:Last 80 unconsumed characters: htmlSource ="\n\n" htmlSource = html_source(document.body,htmlSource," ") htmlSource += "\n\n" My problem has 2 parts. 1. why is div="test" written into the output yet when I check the original src in the browser there is no tag div="test". 2. If I modify the watir.rb src and bypass the call to (document.body,htmlSource," ") by using a diff call (ie.ie.parent.document.body OR i use a filestream to read in a saved copy of the html src for the page ) I don't have the div="test' error but I still end up with other parse errors. I know these must be down to malformed html. but.. when I run the original src html through either HTML tidy or Simpletidy it reports warnings but not errors. The parser in rexml must be more strict? Which validator should I use to independently verify the html so that it's inline with what rexml parser expects? thanks Marco ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] 1.5 modal dialog. Syntax of supported tags ?
David / Bret In reply. david's suggestion to use modal.frame('main').button(:text, 'Yes').click was right. Though I had to change the src of the dialog to use 1) Error:test802(TC_test802):NoMethodError: undefined method `all' for nil:NilClass c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1017/./watir.rb:992:in `ole_inner_elements' c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1017/./watir.rb:1041:in `locate_input_element' c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1017/./watir.rb:3458:in `locate' c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1017/./watir.rb:2235:in `assert_exists' c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1017/./watir.rb:2378:in `click' C:/visual studio projects/VictoriaPolice/AttendanceTests/bug802.rb:45:in `test802' 1 tests, 0 assertions, 0 failures, 1 errors I added an issue for this on the the Jira. thanks for your help Marco From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bret PettichordSent: Tuesday, 30 May 2006 16:27To: wtr-general@rubyforge.orgSubject: Re: [Wtr-general] 1.5 modal dialog. Syntax of supported tags ? On 5/29/06, Neri, Marco <[EMAIL PROTECTED]> wrote: Is the issue that the buttons are defined using submit instead of < input type=button value="Close" - Yes, i think this is the problem. does this means that the modal dialog support in 1.5 is restricted only to dialogs implemented similar to the example in unit test. The modal dialog support works with any objects that can be found in a regular web page. The problem you are running into just happens to be on a modal dialog. It may happen, however, that these tags are more popular on modal dialogs, so that is where we are seeing them. In any case, Watir should support the tag. Would you mind adding a Jira issue for this as a reminder?Bret === The information contained in this email and any files attached may be confidential information to the intended recipient and may be the subject of legal professional privilege or public interest immunity. If you are not the intended recipient, any use, disclosure or copying is unauthorised. If you have received this document in error please telephone 1300 307 082 *** This footnote also confirms that this email message has been swept for the presence of computer viruses. *** ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] 1.5 modal dialog. Syntax of supported tags ?
David Thanks! You're right. Marco -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Schmidt Sent: Wednesday, 31 May 2006 06:19 To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] 1.5 modal dialog. Syntax of supported tags ? Marco, Looking at your HTML below I think that the problem is that your button is located inside a frame, which is loaded via another URL. Because of that, the element would be in a different Watir "container" and wouldn't be found inside the top level container for that modal dialog. Assuming that the frame "main" has the button you want, you should be able to click on it by using: modal.frame('main').button(:text, 'Yes').click Let me know if that works for you. David Schmidt Neri, Marco wrote: > > Hi > > I'm running v1.5.1.1017. I need some help re modal dialog. > > I'm using this code to access a modal dialog: > > @ie.link(:text, "Delete").click_no_wait modal = > @ie.modal_dialog(:title, 'Confirmation') > puts(modal.to_s) > modal.button(:text, 'Yes').click > > In the console the puts shows #. Based > on this I assume it has found the dialog using the title because no > error is thrown. I'm not 100% sure though. I had a look in the src for > ModalDialog.rb but cannot see a method that I could use to to get a > list of all elements in the dialog. > > The button click is not working the console shows the error: > > 1) Error: > test802(TC_test802): > Watir::Exception::UnknownObjectException: Unable to locate object, > using text an d Yes > c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1017/./watir.rb:2237:in > `assert_e > xists' > c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1017/./watir.rb:2378:in > `click' > C:/visual studio > projects/VictoriaPolice/AttendanceTests/bug802.rb:61:in `te st802' > > I have the same issue if I use value and insert a value="Yes" into the > src for the dialog. I also tried using :index > > > The src for the dialog: > > > > Confirmation > > content="http://schemas.microsoft.com/intellisense/ie5"; > name="vs_targetSchema"> > > frameBorder="0"> > > > > > > The src for confirmdelete.aspx: > > > > > > onclick="javascript:OnYesClick();">Yes > onclick="javascript:OnNoClick();">No > > > > Is the issue that the buttons are defined using submit instead of > dialog support in 1.5 is restricted only to dialogs implemented > similar to the example in unit test. ? > > Any suggestions? thanks > > Marco > ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general === The information contained in this email and any files attached may be confidential information to the intended recipient and may be the subject of legal professional privilege or public interest immunity. If you are not the intended recipient, any use, disclosure or copying is unauthorised. If you have received this document in error please telephone 1300 307 082 *** This footnote also confirms that this email message has been swept for the presence of computer viruses. *** ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] 1.5 modal dialog. Syntax of supported tags ?
Title: Re: 1.5 modal dialog. Syntax of supported tags ? Hi I'm running v1.5.1.1017. I need some help re modal dialog. I'm using this code to access a modal dialog: @ie.link(:text, "Delete").click_no_wait modal = @ie.modal_dialog(:title, 'Confirmation') puts(modal.to_s) modal.button(:text, 'Yes').click In the console the puts shows #. Based on this I assume it has found the dialog using the title because no error is thrown. I'm not 100% sure though. I had a look in the src for ModalDialog.rb but cannot see a method that I could use to to get a list of all elements in the dialog. The button click is not working the console shows the error: 1) Error: test802(TC_test802): Watir::Exception::UnknownObjectException: Unable to locate object, using text an d Yes c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1017/./watir.rb:2237:in `assert_e xists' c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1017/./watir.rb:2378:in `click' C:/visual studio projects/VictoriaPolice/AttendanceTests/bug802.rb:61:in `te st802' I have the same issue if I use value and insert a value="Yes" into the src for the dialog. I also tried using :index The src for the dialog: Confirmation http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> The src for confirmdelete.aspx: Is the issue that the buttons are defined using submit instead of <input type=button value="Close" - does this means that the modal dialog support in 1.5 is restricted only to dialogs implemented similar to the example in unit test. ? Any suggestions? thanks Marco === The information contained in this email and any files attached may be confidential information to the intended recipient and may be the subject of legal professional privilege or public interest immunity. If you are not the intended recipient, any use, disclosure or copying is unauthorised. If you have received this document in error please telephone 1300 307 082 *** This footnote also confirms that this email message has been swept for the presence of computer viruses. *** ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] thoughts on how to setup custom command lineparameters?
Hey Philip Thanks for the link to optparse. There's 1 example in the API that I should be able to copy/hack as a start. thanks M -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of philip reed Sent: Tuesday, 28 February 2006 12:49 To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] thoughts on how to setup custom command lineparameters? Marco, Perhaps I'm not understanding your question, but I believe the standard Ruby library optparse is intended to solve the problems you cite with passing command-line parameters: http://www.ruby-doc.org/stdlib/libdoc/optparse/rdoc/index.html I've used it a bit on a non-Watir Ruby project I'm hacking around with, and it's pretty nice once you get the hang of it. Sorry if I'm answering the wrong question. Philip On 2/27/06, Neri, Marco <[EMAIL PROTECTED]> wrote: > Hi > > I'd like to be able to specify additional command line parameters. Eg > url ( dev or sys test envs ), a directory to dump results to, a flag > to close (or not) the browser at the finish of a test. > > What I'm using at the moment is ARGV[] > > Eg @test_site = ARGV[0] > > Problem with this is that the order is fixed and it also seems to > break the -b flag to run the browser minimised. > > If I was to read in the ARGV and then parse the tokens using a regex > that would solve my fixed order problem but what about the -b flag? > > I'd appreciate any suggestions. > > Thanks > > Marco > > > > > === > The information contained in this email and any files attached may be > confidential information to the intended recipient and may be the > subject of legal professional privilege or public interest immunity. > > If you are not the intended recipient, any use, disclosure or copying > is unauthorised. > > If you have received this document in error please telephone 1300 307 > 082 > > *** > This footnote also confirms that this email message has been swept for > the presence of computer viruses. > *** > > > ___ > Wtr-general mailing list > Wtr-general@rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > -- Philip Reed, Developer Positronic Design http://www.positronicdesign.com 617/319.5929 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general === The information contained in this email and any files attached may be confidential information to the intended recipient and may be the subject of legal professional privilege or public interest immunity. If you are not the intended recipient, any use, disclosure or copying is unauthorised. If you have received this document in error please telephone 1300 307 082 *** This footnote also confirms that this email message has been swept for the presence of computer viruses. *** ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] thoughts on how to setup custom command line parameters?
Hi I'd like to be able to specify additional command line parameters. Eg url ( dev or sys test envs ), a directory to dump results to, a flag to close (or not) the browser at the finish of a test. What I'm using at the moment is ARGV[] Eg @test_site = ARGV[0] Problem with this is that the order is fixed and it also seems to break the -b flag to run the browser minimised. If I was to read in the ARGV and then parse the tokens using a regex that would solve my fixed order problem but what about the -b flag? I'd appreciate any suggestions. Thanks Marco === The information contained in this email and any files attached may be confidential information to the intended recipient and may be the subject of legal professional privilege or public interest immunity. If you are not the intended recipient, any use, disclosure or copying is unauthorised. If you have received this document in error please telephone 1300 307 082 *** This footnote also confirms that this email message has been swept for the presence of computer viruses. *** ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] interesting behavior of require in my TestSuitetorun test cases in a sequential order...
I've been trying to get cruise control to work as per Yury's blog http://blogs.byte-force.com/buggins/archive/2005/11/29/704.aspx Based on the example in the blog I have a testsuite.rb with a straight copy / paste of Yury's code. # This part is all of old code to run tests. # (It just picks all test cases from a directory - they start with "tc_") require 'test/unit' Dir['ts_*.rb'].each { |testCase| puts(testCase) } # this is to see the order of ts files Dir['tc_*.rb'].each { |testCase| require testCase } # This is the new part to replace autorunner.rb which would start otherwise. # It should save the resulting XML to a directory named "TestResults". require 'XMLRunner' XMLRunner::report_to 'TestResults' I then have 2 files in the same dir. TS_1.rb and TS_2.rb TS_1.rb: require 'test/unit' require 'TC_LoadHome3.rb' TS_2.rb require 'test/unit' require 'TC_LoadHome2.rb' LoadHome3 is exact same test as LoadHome2 only that it is setup so an assertion fails. I run the testsuite ( either from cmd or CC force build ) and I see that the line Dir['tc_*.rb'].each { |testCase| require testCase } Prints out TS_1.rb and TS_2.rb in order but the tests execute in order of TC_LoadHome2.rb 1st and then TC_LoadHome3.rb. The same also applies if I was to config TS_1.rb to be require 'test/unit' require 'TC_LoadHome3.rb' require 'TC_LoadHome2.rb' Using the example on http://www.ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.h tml I can setup a class and specify the order eg. class TS_MyTests def self.suite suite = Test::Unit::TestSuite.new suite << TC_test000.suite suite << TC_test001.suite suite << TC_test004.suite return suite end end Test::Unit::UI::Console::TestRunner.run(TS_MyTests) This works. ( for me ). Has anyone else come up with another any other method to have the tests execute in the desired order ? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Bolton Sent: Sunday, 8 January 2006 07:13 To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] interesting behavior of require in my TestSuitetorun test cases in a sequential order... Looks to me like they're running in alphabetical order. But why are you using /require/ instead of calling them? ---Michael B. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Roy Sin Sent: January 5, 2006 8:45 PM To: wtr-general@rubyforge.org Subject: [Wtr-general] interesting behavior of require in my TestSuite torun test cases in a sequential order... Hi Wtr, I have a few classes, each class is a test case for a Report and I'm trying to run them all together in a TestSuite. Here is my reports_testsuite.rb : require 'login' # run Test Cases in the order listed below require 'stopRpt_test' require 'landmarkSumRpt_test' require 'mileageSumRpt_test' ... But when i ran it, landmarkSumRpt runs first follow by mileageSumRpt , then the last one is StopRpt. I even tried to prefix with 'test1_stopRpt_test' 'test2_landmarkSumRpt_test' 'test3_mileageSumRpt_test' but still test1_stopRpt_test will run last. I also puts a text at the beginning of each of my test cases to know when each one starts but instead I get: Stop Report Test Case running... Landmark Summary Test Case running... Mileage Summary Test Case running... Loaded suite C:/TestAutomation/workspace/QA_TestAutomation/gmmsunittests_Staging/repo rts/ reports_testsuite1 Started Has anyone experience this type of situation? thanks __ Yahoo! DSL - Something to write home about. Just $16.99/mo. or less. dsl.yahoo.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 _ This e-mail has been scanned for viruses by MCI's Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.mci.com === The information contained in this email and any files attached may be confidential information to the intended recipient and may be the subject of legal professional privilege or public interest immunity. If you are not the intended recipient, any use, disclosure or copying is unauthorised. If you have received this document in error please telephone 1300 307 082 *** This footnote also confirms that this email message has been swept for the presence of computer viruses. *** ___ Wtr-general mailing list Wtr-general@rubyforge.org http
Re: [Wtr-general] (nested?) table access - solution
FYI. Solution to my problem in case anyone else has a similar problem Using wet. Iterate over all the tables in the page. Find the index of the table that matches the desired text. Use the index to access the table. for i in 1..ie.tables.length # count of all tables in the page index = "index:=".concat(i.to_s) text = Browser("title:=MyPage").Table(index.to_s).text md = /^Names \([0-9]+\)$/.match(text) if (md != nil) break end end Browser("title:=MyPage").Table(index).fire_event("onClick") -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Neri, Marco Sent: Monday, 20 February 2006 12:29 To: wtr-general@rubyforge.org Subject: [Wtr-general] (nested?) table access - need help. Hi The developers on the application I'm testing have replaced a (menu) table of url links with rad panel control ( a 3rd party js control from telerik ). Using table = @ie.table(:index , i) in a loop, in the console I can see tabletype: id: PersonLinks_collapsableLinks name: value: disabled: false rows: 34 cols: 1 Using row = @ie.table(:id , 'PersonLinks_collapsableLinks')[3] puts(row[1].to_s) In the console I see ( ) Names (6) Addresses (15) Phone Numbers (6) Photos (21) Physical Descriptions (4) Scars, Marks, Tattoos (10) Miscellaneous IDs (1) Contacts (1) Dossier Known Associates (0) Criminal History Does this suggest that the one cell contains all of the items listed above ? What I was wanting to be able to do was access individual cell and then use .fire_Event("onClick") on it to trigger the menu items. I managed to get this to work for the 1st level of the menu ( details ). table = @ie.table(:id , 'PersonLinks_collapsableLinks') table[3][0].flash table[3][0].fire_event("onClick") The control then expands out the 2nd level of the menu with all of the items listed above. By counting the in the src for the table I can see why the 34 rows. This must also count up the nested tables? How can I access the nested table in order to access the row/cell within that? I can't use id as that tag hasn't been defined for the nested table ? thanks Src for the table is : RadPanelbarAppendStyleSheet('PersonLinks_collapsa bleLinks', '/LEAP/Web/UI/Style/panelbar.css'); Summary Details Names (6) Addresses (15) Phone Numbers (6) Photos (21) Physical Descriptions (4) Scars, Marks, Tattoos (10) Miscellaneous IDs (1) Contacts (1) Dossier Known Associates (0) Criminal History Involvements
[Wtr-general] (nested?) table access - need help.
Hi The developers on the application I'm testing have replaced a (menu) table of url links with rad panel control ( a 3rd party js control from telerik ). Using table = @ie.table(:index , i) in a loop, in the console I can see tabletype: id: PersonLinks_collapsableLinks name: value: disabled: false rows: 34 cols: 1 Using row = @ie.table(:id , 'PersonLinks_collapsableLinks')[3] puts(row[1].to_s) In the console I see ( ) Names (6) Addresses (15) Phone Numbers (6) Photos (21) Physical Descriptions (4) Scars, Marks, Tattoos (10) Miscellaneous IDs (1) Contacts (1) Dossier Known Associates (0) Criminal History Does this suggest that the one cell contains all of the items listed above ? What I was wanting to be able to do was access individual cell and then use .fire_Event("onClick") on it to trigger the menu items. I managed to get this to work for the 1st level of the menu ( details ). table = @ie.table(:id , 'PersonLinks_collapsableLinks') table[3][0].flash table[3][0].fire_event("onClick") The control then expands out the 2nd level of the menu with all of the items listed above. By counting the in the src for the table I can see why the 34 rows. This must also count up the nested tables? How can I access the nested table in order to access the row/cell within that? I can't use id as that tag hasn't been defined for the nested table ? thanks Src for the table is : RadPanelbarAppendStyleSheet('PersonLinks_collapsa bleLinks', '/LEAP/Web/UI/Style/panelbar.css'); Summary Details Names (6) Addresses (15) Phone Numbers (6) Photos (21) Physical Descriptions (4) Scars, Marks, Tattoos (10) Miscellaneous IDs (1) Contacts (1) Dossier Known Associates (0) Criminal History Involvements Interest Flags (8) Whereabouts (2) === The information contained in this email and any files attached may be confidential information to the intended recipient and may be the subject of legal professional privilege or public interest immunity. If you are not the intended recipient, any use, disclosure or copying is unauthorised. If you have received this document in error please telephone 1300 307 082 *** This footn
Re: [Wtr-general] The object invoked has disconnected from itsclients.
Jonathan No. not using winclicker. I still suspect it's something corrupt within my OS as rebooting is not solving my problem. If it was purely a memory leak then a reboot should solve this. I have a utility that sits in the system tray ( meminfo ) that shows memory usage and I do notice it tends to increase over time though I haven't bothered too much what's holding onto the memory as the scripts were still running ok. In regards to Bretts comments about the iexplore process not stopping I'd suggest for those of us using xp to try using taskkill in the teardown for each test. I don't know if there's an equivalent cmd to taskkill for other os's or windows versions. Eg. exec "taskkill /F /IM mspaint.exe /IM iexplore.exe" -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, 9 February 2006 10:47 To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] The object invoked has disconnected from itsclients. Marco; Are you using Winclickers code anywhere in your scripts? I've seen this kind of behavior when using winclickers - it is leaky. -Jonathan Quoting Bret Pettichord <[EMAIL PROTECTED]>: > Marco, > > Thank you for the detailed reply. > > I think you are running into a problem that i've also seen intermittently. > My theory is that there is a resource leak in Watir. After a certain > point, you start getting these errors. > > What i have found is that you can correct this problem by killing the > IEXPLORE.EXE process -- at least for a while. Rebooting has the same effect. > But with time, it recurs. > > The reason i think this is a resource or memory leak is as follows. > > If you start and stop IE manually, you'll see that the IEXPLORE > process dies when IE is closed. However, if you start and stop IE from > a Watir script, the IEXPLORE process is still running. > > This is a problem that very much concerns me. For various reasons, > automated tests tend to open and close browsers more frequently than > humans, so i need to be able to do this reliably. > > I'm planning to look into this further and would appreciate any ideas > that anyone has about this. > > Bret > > > On 2/8/06, Neri, Marco <[EMAIL PROTECTED]> wrote: > > > > Brett > > > > good point about having to put the call to goto before bring_to_front. > > > > I suspect the problem may be something corrupt within ie or the OS. > > what I'd originally set up was a module > > > > module ModuleBrowser > > def startBrowser() > > ie = IE.new > > ie.goto(@test_site) > > ie.bring_to_front() > > ie.maximize() > > return ie > > end > > end > > > > I'd then do a call @ie = startBrowser() from within my scripts. That > > was working reliably. I then started having the errors. So I removed > > the module and put that code directly into my script to see if the > > problem was perhaps getting the reference to the ie object. That > > didn't work > > > > Reason I suspect something corrupt is that running only > > > > @ie = IE.new > > @ie.goto("http://www.google.com";) > > > > is throwing > > > > WIN32OLERuntimeError: Unknown property or method `navigate' > > HRESULT error code:0x80010108 > > The object invoked has disconnected from its clients. > > > > If I run only > > > > @ie = IE.new > > > > is throwing > > > > WIN32OLERuntimeError: document > > OLE error code:80004005 in > > > > It's not a consistent 100% failure sometimes the scripts run but > > more often than not they don't. > > > > So I'll have to try options > > 1) re-install ie > > 2) move all scripts to another box and if it runs reliably there I > > can conclude that problem is within the OS and not ruby/watir/my scripts. > > > > Thanks for helping > > > > I'll let you know what I find > > > > Marco > > > > > > ____ > > > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of Bret > > Pettichord > > Sent: Wednesday, 8 February 2006 16:38 > > To: wtr-general@rubyforge.org > > Subject: Re: [Wtr-general] The object invoked has disconnected from > > its clients. > > > > > > Marco, > > > > I think i may know what the problem is. > > > > Please tell us whether this reliably fixes it: > > > > @ie = IE.new > >
Re: [Wtr-general] The object invoked has disconnected from its clients.
Brett good point about having to put the call to goto before bring_to_front. I suspect the problem may be something corrupt within ie or the OS. what I'd originally set up was a module module ModuleBrowser def startBrowser() ie = IE.new ie.goto(@test_site) ie.bring_to_front() ie.maximize() return ie end end I'd then do a call @ie = startBrowser() from within my scripts. That was working reliably. I then started having the errors. So I removed the module and put that code directly into my script to see if the problem was perhaps getting the reference to the ie object. That didn't work Reason I suspect something corrupt is that running only @ie = IE.new @ie.goto("http://www.google.com";) is throwing WIN32OLERuntimeError: Unknown property or method `navigate' HRESULT error code:0x80010108 The object invoked has disconnected from its clients. If I run only @ie = IE.new is throwing WIN32OLERuntimeError: document OLE error code:80004005 in It's not a consistent 100% failure sometimes the scripts run but more often than not they don't. So I'll have to try options 1) re-install ie 2) move all scripts to another box and if it runs reliably there I can conclude that problem is within the OS and not ruby/watir/my scripts. Thanks for helping I'll let you know what I find Marco From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bret Pettichord Sent: Wednesday, 8 February 2006 16:38 To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] The object invoked has disconnected from its clients. Marco, I think i may know what the problem is. Please tell us whether this reliably fixes it: @ie = IE.new @ie.goto("http://www.google.com";) # any site will do @ie.bring_to_front() Bret On 2/7/06, Neri, Marco <[EMAIL PROTECTED]> wrote: Has anyone else run into this error? ( whats worse is it's intermittent ). I've tried uninstall/reinstall of ruby and watir. >From within my test script I start an ie browser window as per normal @ie = IE.new @ie.bring_to_front() A new browser window is popped up. And that's as far as it gets. And the error is 1) Error: test001(TC_test001): WIN32OLERuntimeError: Unknown property or method `document' HRESULT error code:0x80010108 The object invoked has disconnected from its clients. C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1237:in `method_missing' C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1237:in `title' C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1302:in `bring_to_front' # Make the window come to the front def bring_to_front autoit = WIN32OLE.new('AutoItX3.Control') autoit.WinActivate title, '' end # Return the title of the window def title @ ie.document.title end === The information contained in this email and any files attached may be confidential information to the intended recipient and may be the subject of legal professional privilege or public interest immunity. If you are not the intended recipient, any use, disclosure or copying is unauthorised. If you have received this document in error please telephone 1300 307 082 *** This footnote also confirms that this email message has been swept for the presence of computer viruses. *** ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general === The information contained in this email and any files attached may be confidential information to the intended recipient and may be the subject of legal professional privilege or public interest immunity. If you are not the intended recipient, any use, disclosure or copying is unauthorised. If you have received this document in error please telephone 1300 307 082 *** This footnote also confirms that this email message has been swept for the presence of computer viruses. *** ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] The object invoked has disconnected from its clients.
Has anyone else run into this error? ( whats worse is it's intermittent ). I've tried uninstall/reinstall of ruby and watir. >From within my test script I start an ie browser window as per normal @ie = IE.new @ie.bring_to_front() A new browser window is popped up. And that's as far as it gets. And the error is 1) Error: test001(TC_test001): WIN32OLERuntimeError: Unknown property or method `document' HRESULT error code:0x80010108 The object invoked has disconnected from its clients. C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1237:in `method_missing' C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1237:in `title' C:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1302:in `bring_to_front' # Make the window come to the front def bring_to_front autoit = WIN32OLE.new('AutoItX3.Control') autoit.WinActivate title, '' end # Return the title of the window def title @ie.document.title end === The information contained in this email and any files attached may be confidential information to the intended recipient and may be the subject of legal professional privilege or public interest immunity. If you are not the intended recipient, any use, disclosure or copying is unauthorised. If you have received this document in error please telephone 1300 307 082 *** This footnote also confirms that this email message has been swept for the presence of computer viruses. *** ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] wet ModalDialog problem ?
Ok. Thanks for that. Now that I understand it's not a javascript modal dialog I'll try to do this .. Start a new thread before launching the dialog ( with a suitable time delay ) In the new thread try to use the attach method of watir object to attach to the dialog by url or title Then click the yes button using standard watir button click ( get developers to add in either name or value tags ) M I'm open to other suggestions ... -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Raghu Venkataramana Sent: Monday, 16 January 2006 13:39 To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] wet ModalDialog problem ? If it is a HTML modal dialog, unfortunately it wont work. WET has a good support for javascript popups but currently doesn't support modal dialogs. Raghu Neri, Marco wrote: > Hi ( this is more of a wet than watir issue but I'm hoping someone > else can help ) > > I'm using wet (0.5.3) to open a custom confirm delete dialog using : > > Browser("title:=Victoria Police - > Attendance").Link("text:=Delete").click_without_blocking > puts(Browser("title:=Victoria Police - > Attendance").Dialog("title:=Confirmation -- Web Page Dialog").to_s) > Browser("title:=Victoria Police - > Attendance").Dialog("title:=Confirmation -- Web Page > Dialog").Button("text:=Yes").click > #puts(Browser("title:=Victoria Police - > Attendance").Dialog("title:=Confirmation -- Web Page > Dialog").Button("text:=Yes").to_s) > > The dialog opens but the line to click the yes button times out and an > exception is thrown. If I comment out out the click and uncomment the > puts I see that the ModalDialog button function returns nil so It > cannot find the button. > > here's a snippet from the source. > > > Are you sure you want to delete this record? id="confirmbuttons"> onclick="javascript:OnYesClick();">Yes > onclick="javascript:OnNoClick();">No > > > I'm at a loss as to why. > > Marco > > > > > > === > > The information contained in this email and any files attached may > > be confidential information to the intended recipient and may be > > the subject of legal professional privilege or public interest immunity. > > > > If you are not the intended recipient, any use, disclosure or copying > is > > unauthorised. > > > > If you have received this document in error please telephone 1300 307 > 082 > > > > *** > > This footnote also confirms that this email message has been swept > > for the presence of computer viruses. > > *** > > > >--- >- > >___ >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 === The information contained in this email and any files attached may be confidential information to the intended recipient and may be the subject of legal professional privilege or public interest immunity. If you are not the intended recipient, any use, disclosure or copying is unauthorised. If you have received this document in error please telephone 1300 307 082 *** This footnote also confirms that this email message has been swept for the presence of computer viruses. *** ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] wet ModalDialog problem ?
Hi ( this is more of a wet than watir issue but I'm hoping someone else can help ) I'm using wet (0.5.3) to open a custom confirm delete dialog using : Browser("title:=Victoria Police - Attendance").Link("text:=Delete").click_without_blockingputs(Browser("title:=Victoria Police - Attendance").Dialog("title:=Confirmation -- Web Page Dialog").to_s)Browser("title:=Victoria Police - Attendance").Dialog("title:=Confirmation -- Web Page Dialog").Button("text:=Yes").click #puts(Browser("title:=Victoria Police - Attendance").Dialog("title:=Confirmation -- Web Page Dialog").Button("text:=Yes").to_s) The dialog opens but the line to click the yes button times out and an exception is thrown. If I comment out out the click and uncomment the puts I see that the ModalDialog button function returns nil so It cannot find the button. here's a snippet from the source. Are you sure you want to delete this record? Yes No I'm at a loss as to why. Marco === The information contained in this email and any files attached may be confidential information to the intended recipient and may be the subject of legal professional privilege or public interest immunity. If you are not the intended recipient, any use, disclosure or copying is unauthorised. If you have received this document in error please telephone 1300 307 082 *** This footnote also confirms that this email message has been swept for the presence of computer viruses. *** ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] how to rescue failed assertion and still generate the correct test stats?
Hi 1st time newbie post. below is part of a script I'd put together based on the user guide examples. begin assert($ie.contains_text(AttendanceHomeProperties::Reports) ) puts("Found test string " + AttendanceHomeProperties::Reports )assert($ie.contains_text(AttendanceHomeProperties::UnknownPerson) ) puts("Found test string " + AttendanceHomeProperties::UnknownPerson ) result = 'TEST PASSED.' #rescue => e#rescue Test::Unit::Error => erescue Test::Unit::AssertionFailure=> e $ie.screen_capture(prefix_test_name(@@test_name, 'assertion failure.jpg') , true, false) puts("TEST FAILED." + e.message + "\n" + e.backtrace.join("\n")) ensure puts(result) $ie.close() puts " " puts "## finish test: "+ @@test_nameend I have 3 scenarios. 1. if i use rescue => e then when for eg 2nd assertion fails execution steps into the rescue block and the screen capture and TEST FAILED and back trace are output to console. but this results in 1 tests, 2 assertions, 0 failures, 0 errors. obviously not what I want 0 failure and 0 error isn't correct. 2. if i use rescue Test::Unit::Error => e then when 2nd assertion fails execution seems to bypass the rescue block ( no screen capture ) but it does report 1 tests, 2 assertions, 0 failures 1 error ( or the other way round 1 failure 0 error can't remember off the top of my head ) 3. if i use rescue Test::Unit::AssertionFailure=> e its the same behaiviour as for 2. but it reports the opposite 1failure, 0 error. which method should I use to capture a failed assertion ( rescue => e captures everything but breaks the test unit count of the failures and errors? ) and still have it execute the code in the rescue block? I'm hoping someone has come up against this before and thought up a better solution as I only started trapping Test::Unit::AssertionFailure based on a comments I'd read in the ruby rdoc re Test::Unit::Assertions. thanks Marco ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general