Re: [wtr-general] Re: How to know if the checkbox is checked or not?
Hi, Please can you define about to_s which you wrote in a statement, becasue i am getting error of it. Thanks On Friday, April 3, 2009 6:00:59 PM UTC+5, Darin Duphorn wrote: Sorry it was checked instead of set. If you want to validate it true or false remember to set it to string. if $ie.checkbox(:name,blah).checked?.to_s = 'true' end -Original Message- From: watir-...@googlegroups.com javascript: [mailto:watir-...@googlegroups.com javascript:] On Behalf Of Darin Duphorn Sent: Friday, April 03, 2009 7:58 AM To: watir-...@googlegroups.com javascript: Subject: [wtr-general] Re: How to know if the checkbox is checked or not? $ie.checkbox(:name,blah).isSet? Also, this has been posted many times, so you can use the search. -Original Message- From: watir-...@googlegroups.com javascript: [mailto:watir-...@googlegroups.com javascript:] On Behalf Of Jarmo Pertman Sent: Friday, April 03, 2009 7:54 AM To: Watir General Subject: [wtr-general] Re: How to know if the checkbox is checked or not? There is also ie.checkbox.checked? which is the one i am using, because it's most straightforward. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Failed 'assert' statement doesn't get rescued
I'm pretty new to watir and I'm loving it so far, but I'm struggling to get the 'assert' to work the way I need it to. When I use 'assert' in a 'begin-rescue' block, a failure of the assertion never seems to trigger the rescue, and therefore I cannot log the error message to a file or grab a screenshot or anything else. It simply outputs the failure to the console and goes to the end of the block (it will hit the 'ensure' statement if I use one). I feel like this is a pretty simple issue, but I can't seem to get around it. Anyone able to guide me down the right path? Here's my simple script: require 'watir' require 'test/unit' $ie = Watir::Browser.new $ie.goto 'http://google.com' class TC_Sample Test::Unit::TestCase def test_01 begin assert($ie.text.include?(Watir), 'Cannot locate the text Watir') rescue puts 'Rescued the assert' end end end And here's the output from it: Run options: # Running tests: F Finished tests in 0.009000s, 111. tests/s, 111. assertions/s. 1) Failure: test_01(TC_Sample) [test1.rb:10]: Cannot locate the text Watir 1 tests, 1 assertions, 1 failures, 0 errors, 0 skips Thanks in advance. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Re: How to know if the checkbox is checked or not?
On Wed, Dec 19, 2012 at 7:18 AM, ehsan@wemotech.com wrote: Please can you define about to_s which you wrote in a statement, becasue i am getting error of it. to_s → string Returns a string representing obj. The default to_s prints the object’s class and an encoding of the object id. As a special case, the top-level object that is the initial execution context of Ruby programs returns “main.” More information: http://ruby-doc.org/core-1.9.3/Object.html#method-i-to_s Željko -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: How to know if the checkbox is checked or not?
Hi, do you have skype id ? i am working on Watir,m so i need a little help in that when i needed. or please add me on Skype Name: ehsan.ali.2727 Thanks On Thursday, April 2, 2009 10:03:20 PM UTC+5, satish wrote: I have a checkbox, I have to perform check every time whether it is checked or not. Can some one help me with code. Thank you, Satish. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Failed 'assert' statement doesn't get rescued
On Tue, Dec 18, 2012 at 6:18 PM, captin dmur...@rwbaird.com wrote: and therefore I cannot log the error message to a file or grab a screenshot or anything else. Rescuing exceptions so you can log the error message or take a screen shot is the wrong way to do it. My test/unit-fu is pretty rusty, but you should be able to create custom formatter (at least that is how I would do it in RSpec or Cucumber). Is there a reason you are using test/unit instead of RSpec or Cucumber? That said, I have simplified the code that you have posted a bit, and it rescues the exception on my machine. require 'test/unit' class TC_Sample Test::Unit::TestCase def test_01 begin assert(false) rescue Test::Unit::AssertionFailedError puts Batdog to the Rescue! end end end The script rescues the exception if I use just rescue or rescue Test::Unit::AssertionFailedError. $ ruby test.rb Loaded suite test Started Batdog to the Rescue! . Finished in 0.017473 seconds. 1 tests, 1 assertions, 0 failures, 0 errors $ ruby -v ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0] What version of Ruby are you using? Željko -- https://leanpub.com/watirbook -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Re: How to know if the checkbox is checked or not?
On Wed, Dec 19, 2012 at 12:08 PM, ehsan@wemotech.com wrote: do you have skype id Are you asking the entire Google group? :) If you have a question, post it to the group. Željko -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Failed 'assert' statement doesn't get rescued
Thank you for your reply and for taking the time to assist me. As I stated in my OP, I'm new to watir. I've come across RSpec and Cucumber many times as I've been learning but have yet to dig into them. I will most likely be evaluating those in the near future, but I wanted to understand the fundamentals first and maybe build my own basic test framework. I wasn't able to get your simplified example to work for me. Here's my ruby version: ruby 1.9.3p327 (2012-11-10) [i386-mingw32] When I run your unaltered example, it gives the following output: Run options: # Running tests: E Finished tests in 0.002000s, 500. tests/s, 500. assertions/s. 1) Error: test_01(TC_Sample): NameError: uninitialized constant Test::Unit::AssertionFailedError test1.rb:22:in `rescue in test_01' test1.rb:20:in `test_01' 1 tests, 1 assertions, 0 failures, 1 errors, 0 skips When I comment out the Test::Unit::AssertionFailedError so the rescue is simplified, it seems to skip the rescue just like my original example did: Run options: # Running tests: F Finished tests in 0.002000s, 500. tests/s, 500. assertions/s. 1) Failure: test_01(TC_Sample) [test1.rb:21]: Failed assertion, no message given. 1 tests, 1 assertions, 1 failures, 0 errors, 0 skips Do you think the difference in behavior is due to the Ruby versions? Or maybe due to differences in our gem versions? Here's my gem list: *** LOCAL GEMS *** addressable (2.3.2) bigdecimal (1.1.0) builder (3.1.4) childprocess (0.3.6) commonwatir (4.0.0) ffi (1.2.0 x86-mingw32) firewatir (1.9.4) hoe (3.3.1) io-console (0.3) json (1.5.4) libwebsocket (0.1.6.1) logger (1.2.8) mini_magick (3.2.1) minitest (2.5.1) multi_json (1.3.7) nokogiri (1.5.5 x86-mingw32) rake (0.9.2.2) rautomation (0.7.3) rdoc (3.9.4) rubyzip (0.9.9) s4t-utils (1.0.4) selenium-webdriver (2.26.0) subexec (0.0.4) test-unit (2.5.3) user-choices (1.1.6.1) watir (4.0.2 x86-mingw32) watir-classic (3.3.0) watir-webdriver (0.6.1) websocket (1.0.4) win32-api (1.4.8 x86-mingw32) win32-process (0.7.0) win32screenshot (1.0.7) windows-api (0.4.2) windows-pr (1.2.2) xml-simple (1.1.2) Thanks again for your help. Captin On Wednesday, December 19, 2012 5:15:07 AM UTC-6, Željko Filipin wrote: Rescuing exceptions so you can log the error message or take a screen shot is the wrong way to do it. My test/unit-fu is pretty rusty, but you should be able to create custom formatter (at least that is how I would do it in RSpec or Cucumber). Is there a reason you are using test/unit instead of RSpec or Cucumber? That said, I have simplified the code that you have posted a bit, and it rescues the exception on my machine. require 'test/unit' class TC_Sample Test::Unit::TestCase def test_01 begin assert(false) rescue Test::Unit::AssertionFailedError puts Batdog to the Rescue! end end end The script rescues the exception if I use just rescue or rescue Test::Unit::AssertionFailedError. $ ruby test.rb Loaded suite test Started Batdog to the Rescue! . Finished in 0.017473 seconds. 1 tests, 1 assertions, 0 failures, 0 errors $ ruby -v ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0] What version of Ruby are you using? Željko -- https://leanpub.com/watirbook -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Timeout error
I am using watir web driver to automate a website and extract data from it. There is a scenario where i have to save the loaded page as html and extract data from the table. For the page to load it takes more than 10 minutes and i get a timeout errors, while the process happens on the background and displays the table, I am unable to overcome the timeout error and extract data from the displayed table. def rescue_wait_retry( block) begin return yield rescue Timeout::error =e puts Page load time :#{e} retry end end rescue_wait_retry{ browser = Watir::Browser.start https://www.mydeveloperconnecion.com; . . . . . html = browser.html . . . . . html_button =browser.radio:id='34radio' html_button.exists? html_button.click # after i click a radio button for a html page to lad, it displays the html page in the browser after 10-15 minute, and i get timeout error and unable to parse table. def parse_nokogiri_table(html) { parsing goes here } parse_nokogiri_table Please help me. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Timeout error
On Wed, Dec 19, 2012 at 5:24 PM, sunitha m m.sunitha0...@gmail.com wrote: For the page to load it takes more than 10 minutes and i get a timeout errors So, the problem is that the page takes 10 minutes to open? What happens when you try to open the page manually? Can you share the URL? Željko -- https://leanpub.com/watirbook -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Timeout error
I would think that 10 minutes for a page to load is unacceptable for anyone. I would talk to the devs and tell them about this defect. On Wed, Dec 19, 2012 at 11:40 AM, Željko Filipin zeljko.fili...@gmail.comwrote: On Wed, Dec 19, 2012 at 5:24 PM, sunitha m m.sunitha0...@gmail.comwrote: For the page to load it takes more than 10 minutes and i get a timeout errors So, the problem is that the page takes 10 minutes to open? What happens when you try to open the page manually? Can you share the URL? Željko -- https://leanpub.com/watirbook -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Problems with Select Lists in my application
I am doing some automation in my application, in one part there is a select list which fires an event on change, when I try to select an option there it is popup a window with a button in it (OK). The bad thing is that Watir keeps waiting something when I select an option. I need something like click_no_wait for select lists. Please help me with this issue, I tried some solutions in posted in the web. BTW, I am using ruby 1.8 with watir 1.9 Regards, MArco -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Failed 'assert' statement doesn't get rescued
Since you are using Ruby 1.9.3, the line require 'test/unit' Will require the Minitest gem. In contrast, in Ruby 1.8.7, this would include the Test::Unit gem. If you do a rescue without a type specified, the default type is StandardError, which is a subclass of Exception. In Minitest, when an assertion fails, a MiniTest::Assertion is thrown. This is a subclass of Exception rather than StandardError. Hence it will not be caught by the rescue. You need to add the exception type: require 'test/unit' class TC_Sample Test::Unit::TestCase def test_01 begin assert(false) rescue MiniTest::Assertion p Batdog to the Rescue! end end end - Justin Ko On Wednesday, December 19, 2012 10:35:26 AM UTC-5, captin wrote: Thank you for your reply and for taking the time to assist me. As I stated in my OP, I'm new to watir. I've come across RSpec and Cucumber many times as I've been learning but have yet to dig into them. I will most likely be evaluating those in the near future, but I wanted to understand the fundamentals first and maybe build my own basic test framework. I wasn't able to get your simplified example to work for me. Here's my ruby version: ruby 1.9.3p327 (2012-11-10) [i386-mingw32] When I run your unaltered example, it gives the following output: Run options: # Running tests: E Finished tests in 0.002000s, 500. tests/s, 500. assertions/s. 1) Error: test_01(TC_Sample): NameError: uninitialized constant Test::Unit::AssertionFailedError test1.rb:22:in `rescue in test_01' test1.rb:20:in `test_01' 1 tests, 1 assertions, 0 failures, 1 errors, 0 skips When I comment out the Test::Unit::AssertionFailedError so the rescue is simplified, it seems to skip the rescue just like my original example did: Run options: # Running tests: F Finished tests in 0.002000s, 500. tests/s, 500. assertions/s. 1) Failure: test_01(TC_Sample) [test1.rb:21]: Failed assertion, no message given. 1 tests, 1 assertions, 1 failures, 0 errors, 0 skips Do you think the difference in behavior is due to the Ruby versions? Or maybe due to differences in our gem versions? Here's my gem list: *** LOCAL GEMS *** addressable (2.3.2) bigdecimal (1.1.0) builder (3.1.4) childprocess (0.3.6) commonwatir (4.0.0) ffi (1.2.0 x86-mingw32) firewatir (1.9.4) hoe (3.3.1) io-console (0.3) json (1.5.4) libwebsocket (0.1.6.1) logger (1.2.8) mini_magick (3.2.1) minitest (2.5.1) multi_json (1.3.7) nokogiri (1.5.5 x86-mingw32) rake (0.9.2.2) rautomation (0.7.3) rdoc (3.9.4) rubyzip (0.9.9) s4t-utils (1.0.4) selenium-webdriver (2.26.0) subexec (0.0.4) test-unit (2.5.3) user-choices (1.1.6.1) watir (4.0.2 x86-mingw32) watir-classic (3.3.0) watir-webdriver (0.6.1) websocket (1.0.4) win32-api (1.4.8 x86-mingw32) win32-process (0.7.0) win32screenshot (1.0.7) windows-api (0.4.2) windows-pr (1.2.2) xml-simple (1.1.2) Thanks again for your help. Captin On Wednesday, December 19, 2012 5:15:07 AM UTC-6, Željko Filipin wrote: Rescuing exceptions so you can log the error message or take a screen shot is the wrong way to do it. My test/unit-fu is pretty rusty, but you should be able to create custom formatter (at least that is how I would do it in RSpec or Cucumber). Is there a reason you are using test/unit instead of RSpec or Cucumber? That said, I have simplified the code that you have posted a bit, and it rescues the exception on my machine. require 'test/unit' class TC_Sample Test::Unit::TestCase def test_01 begin assert(false) rescue Test::Unit::AssertionFailedError puts Batdog to the Rescue! end end end The script rescues the exception if I use just rescue or rescue Test::Unit::AssertionFailedError. $ ruby test.rb Loaded suite test Started Batdog to the Rescue! . Finished in 0.017473 seconds. 1 tests, 1 assertions, 0 failures, 0 errors $ ruby -v ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0] What version of Ruby are you using? Željko -- https://leanpub.com/watirbook -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Failed 'assert' statement doesn't get rescued
On Wed, Dec 19, 2012 at 12:15 PM, Željko Filipin zeljko.fili...@gmail.comwrote: That said, I have simplified the code that you have posted a bit, and it rescues the exception on my machine. require 'test/unit' class TC_Sample Test::Unit::TestCase def test_01 begin assert(false) rescue Test::Unit::AssertionFailedError puts Batdog to the Rescue! end end end Simplifying the code even further (methods do not need begin-end block to use rescue) and adding a piece of Justin's wisdom: require 'test/unit' class TC_Sample Test::Unit::TestCase def test_01 assert(false) rescue MiniTest::Assertion p Batdog to the Rescue! end end $ ruby test.rb Run options: # Running tests: Batdog to the Rescue! . Finished tests in 0.001786s, 559.9104 tests/s, 559.9104 assertions/s. 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips Can you notice an interesting bug in the output? :) Željko -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Failed 'assert' statement doesn't get rescued
Gentlemen, thank you for the guidance. The MiniTest functionality corrected my issue. @Željko - The bug you mention is interesting...also interesting is if you put single quotes around the text, it will still display with double quotes. Captin On Wednesday, December 19, 2012 3:19:41 PM UTC-6, Željko Filipin wrote: On Wed, Dec 19, 2012 at 12:15 PM, Željko Filipin zeljko@gmail.comjavascript: wrote: That said, I have simplified the code that you have posted a bit, and it rescues the exception on my machine. require 'test/unit' class TC_Sample Test::Unit::TestCase def test_01 begin assert(false) rescue Test::Unit::AssertionFailedError puts Batdog to the Rescue! end end end Simplifying the code even further (methods do not need begin-end block to use rescue) and adding a piece of Justin's wisdom: require 'test/unit' class TC_Sample Test::Unit::TestCase def test_01 assert(false) rescue MiniTest::Assertion p Batdog to the Rescue! end end $ ruby test.rb Run options: # Running tests: Batdog to the Rescue! . Finished tests in 0.001786s, 559.9104 tests/s, 559.9104 assertions/s. 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips Can you notice an interesting bug in the output? :) Željko -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Failed 'assert' statement doesn't get rescued
On Wed, Dec 19, 2012 at 10:40 PM, captin dmur...@rwbaird.com wrote: also interesting is if you put single quotes around the text, it will still display with double quotes. You can create a ruby string several ways, two of them are single and double quotes, but when you ask Ruby to output the string with p, it will always output double quotes. Željko -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Open browser test automation at WMF
I think this blog post will be interesting to people on this list: http://watir.com/2012/12/20/open-browser-test-automation-at-wmf/ Disclaimer: Chris, the author of the blog post is my boss. By the way, if you or your company are doing something interesting with Watir, let me know here or privately. If you write a good blog post, I will be more than happy to post it at watir.com. Željko -- https://leanpub.com/watirbook -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Timeout error
Hi Zeljko, Its official, cannot share it. Even manually it takes about 10 minutes to open. Thanks, sunitha. On Wednesday, December 19, 2012 11:40:46 AM UTC-5, Željko Filipin wrote: On Wed, Dec 19, 2012 at 5:24 PM, sunitha m m.suni...@gmail.comjavascript: wrote: For the page to load it takes more than 10 minutes and i get a timeout errors So, the problem is that the page takes 10 minutes to open? What happens when you try to open the page manually? Can you share the URL? Željko -- https://leanpub.com/watirbook -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Looong pauses while calling present?, exists?, etc... - why do you think this happens?
OSX 10.8.2 and Ubuntu 12.10 -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com