Re: [wtr-general] retrieve hidden text values with watir webdriver

2013-03-07 Thread captin
Great. I don't use webdriver so that probably explains why .text didn't 
work for you but .value did.
 

On Thursday, March 7, 2013 11:22:44 AM UTC-6, fabian@gmail.com wrote:

> Hi captin!
>
> Well, you almost hit the jackpot. What actually worked was:
>
> puts browser.hidden(:name => 'ReqTitle').value
>
> When I tried your suggestion, I got a blank line. So I replaced 'text' 
> with 'value' and it worked like magic.
>
>
> Thanks!!
>

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [wtr-general] retrieve hidden text values with watir webdriver

2013-03-07 Thread captin
Try:
puts browser.hidden(:name => 'reqtitle').text

 
 

On Thursday, March 7, 2013 10:37:23 AM UTC-6, fabian@gmail.com wrote:

> Hi Joe,
>
> All I'have tried so far is:
>
> puts browser.text_field(:name => 'reqtitle').text
> puts browser.text_field(:name => 'reqtitle').value
>
> Fabian
>
> El jueves, 7 de marzo de 2013 13:51:37 UTC-2, Joe Fl escribió:
>>
>> Hi, 
>>
>> Can you paste your code? 
>>
>> Joe 
>>
>> On Thu, Mar 7, 2013 at 10:47 AM,   wrote: 
>> > Hey guys! 
>> > 
>> > I'm trying to retrieve the text from a textarea, which appears as 
>> hidden, 
>> > although I can dee it on the browser. This is the html tag: 
>> > 
>> >  
>> >   
>> >Certification Request Number 
>> > 
>> >   
>> >  
>> > 
>> > I would like to grab  the value "Certification Request Number", but I 
>> get 
>> > this error: 
>> > 
>> > 
>> > (...) `assert_exists': unable to locate element, using 
>> {:name=>"reqtitle", 
>> > :tag_name=>"input or textarea", :type=>"(any text type)"} 
>> > (Watir::Exception::UnknownObjectException) 
>> > 
>> > I've done my research on the mailing list and couldn't find anything 
>> > ...Also, I could grab the text in the  tags, but they are 
>> inside a 
>> > table, which is inside a table inside a table and another table and so 
>> on, 
>> > so it's impossible to track. 
>> > 
>> > Ideas? 
>> > 
>> > Thanks! 
>> > Fabian 
>> > 
>> > 
>> > 
>> > -- 
>> > -- 
>> > Before posting, please read http://watir.com/support. In short: search 
>> > before you ask, be nice. 
>> > 
>> > watir-...@googlegroups.com 
>> > http://groups.google.com/group/watir-general 
>> > watir-genera...@googlegroups.com 
>> > 
>> > --- 
>> > You received this message because you are subscribed to the Google 
>> Groups 
>> > "Watir General" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an 
>> > email to watir-genera...@googlegroups.com. 
>> > For more options, visit https://groups.google.com/groups/opt_out. 
>> > 
>> > 
>>
>

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[wtr-general] Re: watir-classic issue with execute_script and JSON

2013-02-13 Thread captin
So for me, if I run the execute_script commands against the HTML page I 
created (with the content either unblocked or the previously mentioned IE 
setting enabled), everything works. As soon as I navigate to a different 
page and run the command again, it fails as above.
 
Glad to hear there's a resolution for enroxorz. I'm guessing there is 
probably another setting or two that I need to find to get it working on my 
end. One more detail I have not yet mentioned is that I'm running on 
Windows Vista Service Pack 2 (it is probably inconsequential).
 
 

On Wednesday, February 13, 2013 3:12:21 PM UTC-6, Jarmo Pertman wrote:

> :(
>
> What about opening the html you created above?
>
> Jarmo Pertman
> -
> IT does really matter - http://itreallymatters.net
>
> On Wednesday, February 13, 2013 10:56:44 PM UTC+2, captin wrote:
>>
>> I located the registry setting and successfully changed it and verified 
>> the setting was enabled. Then I ran the execute_script command and it still 
>> errored out with the original error message and code:
>>  
>> WIN32OLERuntimeError: (in OLE method `execScript': )
>> OLE error code:80020101 in 
>>   Could not complete the operation due to error 80020101.
>> HRESULT error code:0x80020009
>>   Exception occurred.
>> from 
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/page-container.rb:29:in
>>  
>> `method_missing'
>> from 
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/page-container.rb:29:in
>>  
>> `rescue in execute_script'
>> from 
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/page-container.rb:22:in
>>  
>> `execute_script'
>> from (irb):3
>> from C:/Ruby193/bin/irb:12:in `'
>>  
>>  
>>
>> On Wednesday, February 13, 2013 2:40:20 PM UTC-6, captin wrote:
>>
>>> The HTML code worked properly when I fixed the extra character issue you 
>>> highlighted. When I run the "typeof JSON" command it returns "object" and 
>>> when I run "typeof JSON.stringify" it returns "function".
>>>  
>>> My enterprise security settings don't allow me to change that setting so 
>>> I'm unable to prove out your theory. On my system, the setting appears to 
>>> be disabled by default, and when I open the HTML file from your previous 
>>> suggestion I get a message saying there's blocked content, but I'm able to 
>>> click a button to allow it. I am able to modify my registry, so if I can 
>>> locate that setting in the registry I might be able to test out your theory.
>>>  
>>> In the meantime, maybe enroxorz is able to proove it out.
>>>  
>>> Thanks.
>>>  
>>>
>>> On Wednesday, February 13, 2013 2:28:56 PM UTC-6, Jarmo Pertman wrote:
>>>
>>>> I think that i can reproduce the problem with tweaking a setting in IE.
>>>>
>>>> There is a setting under Internet Options -> Advanced -> Security -> 
>>>> Allow active content to run in files on My Computer. This is disabled by 
>>>> default. Enable it, restart IE and try if it will make #execute_script 
>>>> working.
>>>>
>>>> Jarmo Pertman
>>>> -
>>>> IT does really matter - http://itreallymatters.net
>>>>
>>>> On Wednesday, February 13, 2013 10:15:50 PM UTC+2, Jarmo Pertman wrote:
>>>>>
>>>>> I just noticed an error in my previous code. I have an extra ' 
>>>>> character at the start of src attribute value :(
>>>>>
>>>>> Please try again with the following correct code:
>>>>> 
>>>>>   
>>>>> >>>> src="file:///C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/ext/json2.js">
>>>>>   
>>>>>   
>>>>> foo
>>>>>   
>>>>> 
>>>>>
>>>>> Jarmo Pertman
>>>>> -
>>>>> IT does really matter - http://itreallymatters.net
>>>>>
>>>>> On Wednesday, February 13, 2013 3:14:42 PM UTC+2, enroxorz wrote:
>>>>>>
>>>>>> Please make sure to post your findings. I've been monitoring this 
>>>>>> because I also have the same issue as you (didn't post because I didn't 
>>>>>> have anything

[wtr-general] Re: watir-classic issue with execute_script and JSON

2013-02-13 Thread captin
I located the registry setting and successfully changed it and verified the 
setting was enabled. Then I ran the execute_script command and it still 
errored out with the original error message and code:
 
WIN32OLERuntimeError: (in OLE method `execScript': )
OLE error code:80020101 in 
  Could not complete the operation due to error 80020101.
HRESULT error code:0x80020009
  Exception occurred.
from 
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/page-container.rb:29:in
 
`method_missing'
from 
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/page-container.rb:29:in
 
`rescue in execute_script'
from 
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/page-container.rb:22:in
 
`execute_script'
from (irb):3
from C:/Ruby193/bin/irb:12:in `'
 
 

On Wednesday, February 13, 2013 2:40:20 PM UTC-6, captin wrote:

> The HTML code worked properly when I fixed the extra character issue you 
> highlighted. When I run the "typeof JSON" command it returns "object" and 
> when I run "typeof JSON.stringify" it returns "function".
>  
> My enterprise security settings don't allow me to change that setting so 
> I'm unable to prove out your theory. On my system, the setting appears to 
> be disabled by default, and when I open the HTML file from your previous 
> suggestion I get a message saying there's blocked content, but I'm able to 
> click a button to allow it. I am able to modify my registry, so if I can 
> locate that setting in the registry I might be able to test out your theory.
>  
> In the meantime, maybe enroxorz is able to proove it out.
>  
> Thanks.
>  
>
> On Wednesday, February 13, 2013 2:28:56 PM UTC-6, Jarmo Pertman wrote:
>
>> I think that i can reproduce the problem with tweaking a setting in IE.
>>
>> There is a setting under Internet Options -> Advanced -> Security -> 
>> Allow active content to run in files on My Computer. This is disabled by 
>> default. Enable it, restart IE and try if it will make #execute_script 
>> working.
>>
>> Jarmo Pertman
>> -
>> IT does really matter - http://itreallymatters.net
>>
>> On Wednesday, February 13, 2013 10:15:50 PM UTC+2, Jarmo Pertman wrote:
>>>
>>> I just noticed an error in my previous code. I have an extra ' character 
>>> at the start of src attribute value :(
>>>
>>> Please try again with the following correct code:
>>> 
>>>   
>>> >> src="file:///C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/ext/json2.js">
>>>   
>>>   
>>> foo
>>>   
>>> 
>>>
>>> Jarmo Pertman
>>> -
>>> IT does really matter - http://itreallymatters.net
>>>
>>> On Wednesday, February 13, 2013 3:14:42 PM UTC+2, enroxorz wrote:
>>>>
>>>> Please make sure to post your findings. I've been monitoring this 
>>>> because I also have the same issue as you (didn't post because I didn't 
>>>> have anything new to add to this).
>>>>
>>>> On Tuesday, February 12, 2013 5:51:37 PM UTC-5, captin wrote:
>>>>>
>>>>> The issue still exists when trying your suggestion. I will play around 
>>>>> with security settings and see if that leads to any resolution.
>>>>>  
>>>>> Thanks!
>>>>>
>>>>> On Saturday, February 9, 2013 5:19:14 AM UTC-6, Jarmo Pertman wrote:
>>>>>
>>>>>> To be honest - i'm not sure where's the problem since i cannot 
>>>>>> reproduce it on my IE8. I have one idea - create a local html file with 
>>>>>> the 
>>>>>> contents:
>>>>>> 
>>>>>>   
>>>>>> >>>>> src="'file:///C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/ext/json2.js">
>>>>>>   
>>>>>>   
>>>>>> foo
>>>>>>   
>>>>>> 
>>>>>>
>>>>>> Open that file with your internet explorer and try then the 
>>>>>> JavaScript commands in the developer tools. If they still don't work 
>>>>>> then 
>>>>>> it has probably something to do with your IE security settings.
>>>>>>
>>>>>> Jarmo Pertman
>>>>>> -
>>>&

[wtr-general] Re: watir-classic issue with execute_script and JSON

2013-02-13 Thread captin
The HTML code worked properly when I fixed the extra character issue you 
highlighted. When I run the "typeof JSON" command it returns "object" and 
when I run "typeof JSON.stringify" it returns "function".
 
My enterprise security settings don't allow me to change that setting so 
I'm unable to prove out your theory. On my system, the setting appears to 
be disabled by default, and when I open the HTML file from your previous 
suggestion I get a message saying there's blocked content, but I'm able to 
click a button to allow it. I am able to modify my registry, so if I can 
locate that setting in the registry I might be able to test out your theory.
 
In the meantime, maybe enroxorz is able to proove it out.
 
Thanks.
 

On Wednesday, February 13, 2013 2:28:56 PM UTC-6, Jarmo Pertman wrote:

> I think that i can reproduce the problem with tweaking a setting in IE.
>
> There is a setting under Internet Options -> Advanced -> Security -> Allow 
> active content to run in files on My Computer. This is disabled by default. 
> Enable it, restart IE and try if it will make #execute_script working.
>
> Jarmo Pertman
> -
> IT does really matter - http://itreallymatters.net
>
> On Wednesday, February 13, 2013 10:15:50 PM UTC+2, Jarmo Pertman wrote:
>>
>> I just noticed an error in my previous code. I have an extra ' character 
>> at the start of src attribute value :(
>>
>> Please try again with the following correct code:
>> 
>>   
>> > src="file:///C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/ext/json2.js">
>>   
>>   
>> foo
>>   
>> 
>>
>> Jarmo Pertman
>> -
>> IT does really matter - http://itreallymatters.net
>>
>> On Wednesday, February 13, 2013 3:14:42 PM UTC+2, enroxorz wrote:
>>>
>>> Please make sure to post your findings. I've been monitoring this 
>>> because I also have the same issue as you (didn't post because I didn't 
>>> have anything new to add to this).
>>>
>>> On Tuesday, February 12, 2013 5:51:37 PM UTC-5, captin wrote:
>>>>
>>>> The issue still exists when trying your suggestion. I will play around 
>>>> with security settings and see if that leads to any resolution.
>>>>  
>>>> Thanks!
>>>>
>>>> On Saturday, February 9, 2013 5:19:14 AM UTC-6, Jarmo Pertman wrote:
>>>>
>>>>> To be honest - i'm not sure where's the problem since i cannot 
>>>>> reproduce it on my IE8. I have one idea - create a local html file with 
>>>>> the 
>>>>> contents:
>>>>> 
>>>>>   
>>>>> >>>> src="'file:///C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/ext/json2.js">
>>>>>   
>>>>>   
>>>>> foo
>>>>>   
>>>>> 
>>>>>
>>>>> Open that file with your internet explorer and try then the JavaScript 
>>>>> commands in the developer tools. If they still don't work then it has 
>>>>> probably something to do with your IE security settings.
>>>>>
>>>>> Jarmo Pertman
>>>>> -
>>>>> IT does really matter - http://itreallymatters.net
>>>>>
>>>>>
>>>>> On Friday, February 8, 2013 5:51:27 PM UTC+2, captin wrote:
>>>>>>
>>>>>> Same result. The script errors just continue to pile up.
>>>>>>  
>>>>>> Do you think this is a bug? If so, is it a json2.js or a 
>>>>>> watir-classic issue?
>>>>>>  
>>>>>> Thanks.
>>>>>>  
>>>>>>
>>>>>> On Friday, February 8, 2013 1:39:14 AM UTC-6, Jarmo Pertman wrote:
>>>>>>
>>>>>>> That's sad to hear. What if you run execute_script two times in a 
>>>>>>> row - will you also get an error for the second run?
>>>>>>>
>>>>>>> Jarmo Pertman
>>>>>>> -
>>>>>>> IT does really matter - http://itreallymatters.net
>>>>>>>
>>>>>>> On Thursday, February 7, 2013 12:58:36 AM UTC+2, captin wrote:
>>>>>>>>
>>>>>>>> Jarmo,
>>>>>>>>  
>>>>>>>> My apologies for the versioning miscommunication. My initi

[wtr-general] Re: watir-classic issue with execute_script and JSON

2013-02-12 Thread captin
The issue still exists when trying your suggestion. I will play around with 
security settings and see if that leads to any resolution.
 
Thanks!

On Saturday, February 9, 2013 5:19:14 AM UTC-6, Jarmo Pertman wrote:

> To be honest - i'm not sure where's the problem since i cannot reproduce 
> it on my IE8. I have one idea - create a local html file with the contents:
> 
>   
>  src="'file:///C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/ext/json2.js">
>   
>   
> foo
>   
> 
>
> Open that file with your internet explorer and try then the JavaScript 
> commands in the developer tools. If they still don't work then it has 
> probably something to do with your IE security settings.
>
> Jarmo Pertman
> -
> IT does really matter - http://itreallymatters.net
>
>
> On Friday, February 8, 2013 5:51:27 PM UTC+2, captin wrote:
>>
>> Same result. The script errors just continue to pile up.
>>  
>> Do you think this is a bug? If so, is it a json2.js or a watir-classic 
>> issue?
>>  
>> Thanks.
>>  
>>
>> On Friday, February 8, 2013 1:39:14 AM UTC-6, Jarmo Pertman wrote:
>>
>>> That's sad to hear. What if you run execute_script two times in a row - 
>>> will you also get an error for the second run?
>>>
>>> Jarmo Pertman
>>> -
>>> IT does really matter - http://itreallymatters.net
>>>
>>> On Thursday, February 7, 2013 12:58:36 AM UTC+2, captin wrote:
>>>>
>>>> Jarmo,
>>>>  
>>>> My apologies for the versioning miscommunication. My initial post and 
>>>> initial error messages are correct with Ruby 1.9.3 and Watir-Classic 
>>>> 3.4.0, 
>>>> but the line "
>>>> json2.src='file:///C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-classic-3.3.0/lib/watir-classic/ext/json2.js';"
>>>>  
>>>> is probably what threw you off. That was a copy/paste mistake. The line 
>>>> that I truly used for troubleshooting was "
>>>> json2.src='file:///C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/ext/json2.js';"
>>>>  
>>>> I hope this clears things up.
>>>>  
>>>> I also tried copying the json2.js file you linked into my watir-classic 
>>>> gem, and then I ran the same troubleshooting commands along with the 
>>>> original watir command I am trying to use. Same results, even though the 
>>>> two json2.js files are slightly different.
>>>>  
>>>>  
>>>>
>>>> On Wednesday, February 6, 2013 11:11:19 AM UTC-6, Jarmo Pertman wrote:
>>>>
>>>>> Hi!
>>>>>
>>>>> I just noticed that you had Ruby 1.9.3 vs 1.9.2 and Watir-Classic 
>>>>> 3.3.0 vs 3.4.0 in your error messages.
>>>>> Which one was it actually and why do they differ?
>>>>>
>>>>> Can you try to copy the watir-classic gem's json2.js file over with 
>>>>> the contents of 
>>>>> https://raw.github.com/douglascrockford/JSON-js/master/json2.js and 
>>>>> see if that makes any difference?
>>>>>
>>>>> Jarmo Pertman
>>>>> -
>>>>> IT does really matter - http://itreallymatters.net
>>>>>
>>>>>
>>>>> On Monday, February 4, 2013 4:53:52 PM UTC+2, captin wrote:
>>>>>>
>>>>>> Jarmo,
>>>>>>  
>>>>>> There is no error when I copy the local json2.js file (located at 
>>>>>> file:///C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/ext/json2.js)
>>>>>>  
>>>>>> contents to the IE developer tools window. When I run the stringify 
>>>>>> command 
>>>>>> you gave me, the out put is "{"a":"foo"}". And I get the exact same 
>>>>>> results when I use the other json2.js you linked and then run the 
>>>>>> command 
>>>>>> again.
>>>>>> I also tried the original commands you gave previously (typeof JSON 
>>>>>> and typeof JSON.stringify) after I loaded the json2.js script manually, 
>>>>>> and 
>>>>>> the outputs were "object" and "function" respectively.
>>>>>>  
>>>>>> In your opinion, is there some sort of automatic loading or accessing 
>

[wtr-general] Re: watir-classic issue with execute_script and JSON

2013-02-08 Thread captin
Same result. The script errors just continue to pile up.
 
Do you think this is a bug? If so, is it a json2.js or a watir-classic 
issue?
 
Thanks.
 

On Friday, February 8, 2013 1:39:14 AM UTC-6, Jarmo Pertman wrote:

> That's sad to hear. What if you run execute_script two times in a row - 
> will you also get an error for the second run?
>
> Jarmo Pertman
> -
> IT does really matter - http://itreallymatters.net
>
> On Thursday, February 7, 2013 12:58:36 AM UTC+2, captin wrote:
>>
>> Jarmo,
>>  
>> My apologies for the versioning miscommunication. My initial post and 
>> initial error messages are correct with Ruby 1.9.3 and Watir-Classic 3.4.0, 
>> but the line "
>> json2.src='file:///C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-classic-3.3.0/lib/watir-classic/ext/json2.js';"
>>  
>> is probably what threw you off. That was a copy/paste mistake. The line 
>> that I truly used for troubleshooting was "
>> json2.src='file:///C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/ext/json2.js';"
>>  
>> I hope this clears things up.
>>  
>> I also tried copying the json2.js file you linked into my watir-classic 
>> gem, and then I ran the same troubleshooting commands along with the 
>> original watir command I am trying to use. Same results, even though the 
>> two json2.js files are slightly different.
>>  
>>  
>>
>> On Wednesday, February 6, 2013 11:11:19 AM UTC-6, Jarmo Pertman wrote:
>>
>>> Hi!
>>>
>>> I just noticed that you had Ruby 1.9.3 vs 1.9.2 and Watir-Classic 3.3.0 
>>> vs 3.4.0 in your error messages.
>>> Which one was it actually and why do they differ?
>>>
>>> Can you try to copy the watir-classic gem's json2.js file over with the 
>>> contents of 
>>> https://raw.github.com/douglascrockford/JSON-js/master/json2.js and see 
>>> if that makes any difference?
>>>
>>> Jarmo Pertman
>>> -
>>> IT does really matter - http://itreallymatters.net
>>>
>>>
>>> On Monday, February 4, 2013 4:53:52 PM UTC+2, captin wrote:
>>>>
>>>> Jarmo,
>>>>  
>>>> There is no error when I copy the local json2.js file (located at 
>>>> file:///C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/ext/json2.js)
>>>>  
>>>> contents to the IE developer tools window. When I run the stringify 
>>>> command 
>>>> you gave me, the out put is "{"a":"foo"}". And I get the exact same 
>>>> results when I use the other json2.js you linked and then run the command 
>>>> again.
>>>> I also tried the original commands you gave previously (typeof JSON and 
>>>> typeof JSON.stringify) after I loaded the json2.js script manually, and 
>>>> the 
>>>> outputs were "object" and "function" respectively.
>>>>  
>>>> In your opinion, is there some sort of automatic loading or accessing 
>>>> issue between JSON and IE?
>>>>  
>>>> Thanks.
>>>>  
>>>> On Saturday, February 2, 2013 9:47:53 AM UTC-6, Jarmo Pertman wrote:
>>>>
>>>>> Can you try by copying all the contents of the json2.js file from 
>>>>> file:///C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-classic-3.3.0/lib/watir-classic/ext/json2.js
>>>>>  to 
>>>>> your IE developer tools window? Do you get any errors when doing that 
>>>>> too? 
>>>>> What does this code return after doing that: JSON.stringify({a: "foo"})
>>>>>
>>>>> What about using the code at 
>>>>> https://raw.github.com/douglascrockford/JSON-js/master/json2.js ?
>>>>>
>>>>> Jarmo Pertman
>>>>> -
>>>>> IT does really matter - http://itreallymatters.net
>>>>>
>>>>>
>>>>> On Thursday, January 31, 2013 1:01:11 AM UTC+2, captin wrote:
>>>>>>
>>>>>> I have encountered an issue with execute_script using IE9 with ruby 
>>>>>> 1.9.3p327 and watir-classic 3.4.0. I was doing some research and found 
>>>>>> my exact 
>>>>>> same issue detailed at Stack 
>>>>>> Overflow<http://stackoverflow.com/questions/14142905/issue-with-execute-script>,
>>>>>>  
>>>>>> but the thread is stale (and I'm too new to be able to

[wtr-general] Re: watir-classic issue with execute_script and JSON

2013-02-06 Thread captin
Jarmo,
 
My apologies for the versioning miscommunication. My initial post and 
initial error messages are correct with Ruby 1.9.3 and Watir-Classic 3.4.0, 
but the line "
json2.src='file:///C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-classic-3.3.0/lib/watir-classic/ext/json2.js';"
 
is probably what threw you off. That was a copy/paste mistake. The line 
that I truly used for troubleshooting was "
json2.src='file:///C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/ext/json2.js';"
 
I hope this clears things up.
 
I also tried copying the json2.js file you linked into my watir-classic 
gem, and then I ran the same troubleshooting commands along with the 
original watir command I am trying to use. Same results, even though the 
two json2.js files are slightly different.
 
 

On Wednesday, February 6, 2013 11:11:19 AM UTC-6, Jarmo Pertman wrote:

> Hi!
>
> I just noticed that you had Ruby 1.9.3 vs 1.9.2 and Watir-Classic 3.3.0 vs 
> 3.4.0 in your error messages.
> Which one was it actually and why do they differ?
>
> Can you try to copy the watir-classic gem's json2.js file over with the 
> contents of 
> https://raw.github.com/douglascrockford/JSON-js/master/json2.js and see 
> if that makes any difference?
>
> Jarmo Pertman
> -
> IT does really matter - http://itreallymatters.net
>
>
> On Monday, February 4, 2013 4:53:52 PM UTC+2, captin wrote:
>>
>> Jarmo,
>>  
>> There is no error when I copy the local json2.js file (located at 
>> file:///C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/ext/json2.js)
>>  
>> contents to the IE developer tools window. When I run the stringify command 
>> you gave me, the out put is "{"a":"foo"}". And I get the exact same 
>> results when I use the other json2.js you linked and then run the command 
>> again.
>> I also tried the original commands you gave previously (typeof JSON and 
>> typeof JSON.stringify) after I loaded the json2.js script manually, and the 
>> outputs were "object" and "function" respectively.
>>  
>> In your opinion, is there some sort of automatic loading or accessing 
>> issue between JSON and IE?
>>  
>> Thanks.
>>  
>> On Saturday, February 2, 2013 9:47:53 AM UTC-6, Jarmo Pertman wrote:
>>
>>> Can you try by copying all the contents of the json2.js file from 
>>> file:///C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-classic-3.3.0/lib/watir-classic/ext/json2.js
>>>  to 
>>> your IE developer tools window? Do you get any errors when doing that too? 
>>> What does this code return after doing that: JSON.stringify({a: "foo"})
>>>
>>> What about using the code at 
>>> https://raw.github.com/douglascrockford/JSON-js/master/json2.js ?
>>>
>>> Jarmo Pertman
>>> -
>>> IT does really matter - http://itreallymatters.net
>>>
>>>
>>> On Thursday, January 31, 2013 1:01:11 AM UTC+2, captin wrote:
>>>>
>>>> I have encountered an issue with execute_script using IE9 with ruby 
>>>> 1.9.3p327 and watir-classic 3.4.0. I was doing some research and found my 
>>>> exact 
>>>> same issue detailed at Stack 
>>>> Overflow<http://stackoverflow.com/questions/14142905/issue-with-execute-script>,
>>>>  
>>>> but the thread is stale (and I'm too new to be able to comment on the 
>>>> issue 
>>>> there). Jarmo was assisting but the OP hasn't responded in over three 
>>>> weeks.
>>>>  
>>>> I hate redundancy but I also hate waiting indefinitely so I figured I'd 
>>>> pose the question here. Using the following code:
>>>>  
>>>> browser.execute_script "window.confirm = function() { return true; }"
>>>>  
>>>> I get the following error:
>>>>  
>>>> WIN32OLERuntimeError: (in OLE method `execScript': )
>>>> OLE error code:80020101 in 
>>>>   Could not complete the operation due to error 80020101.
>>>> HRESULT error code:0x80020009
>>>>   Exception occurred.
>>>> from 
>>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/page-container.rb:29:in
>>>>  
>>>> `method_missing'
>>>> from 
>>>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/page-container.rb:29:in
>>>>  
>>>> `rescue in execute_script'
>>>&g

[wtr-general] Re: watir-classic issue with execute_script and JSON

2013-02-04 Thread captin
Jarmo,
 
There is no error when I copy the local json2.js file (located at 
file:///C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/ext/json2.js)
 
contents to the IE developer tools window. When I run the stringify command 
you gave me, the out put is "{"a":"foo"}". And I get the exact same results 
when I use the other json2.js you linked and then run the command again.
I also tried the original commands you gave previously (typeof JSON and 
typeof JSON.stringify) after I loaded the json2.js script manually, and the 
outputs were "object" and "function" respectively.
 
In your opinion, is there some sort of automatic loading or accessing issue 
between JSON and IE?
 
Thanks.
 
On Saturday, February 2, 2013 9:47:53 AM UTC-6, Jarmo Pertman wrote:

> Can you try by copying all the contents of the json2.js file from 
> file:///C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-classic-3.3.0/lib/watir-classic/ext/json2.js
>  to 
> your IE developer tools window? Do you get any errors when doing that too? 
> What does this code return after doing that: JSON.stringify({a: "foo"})
>
> What about using the code at 
> https://raw.github.com/douglascrockford/JSON-js/master/json2.js ?
>
> Jarmo Pertman
> -
> IT does really matter - http://itreallymatters.net
>
>
> On Thursday, January 31, 2013 1:01:11 AM UTC+2, captin wrote:
>>
>> I have encountered an issue with execute_script using IE9 with ruby 
>> 1.9.3p327 and watir-classic 3.4.0. I was doing some research and found my 
>> exact 
>> same issue detailed at Stack 
>> Overflow<http://stackoverflow.com/questions/14142905/issue-with-execute-script>,
>>  
>> but the thread is stale (and I'm too new to be able to comment on the issue 
>> there). Jarmo was assisting but the OP hasn't responded in over three weeks.
>>  
>> I hate redundancy but I also hate waiting indefinitely so I figured I'd 
>> pose the question here. Using the following code:
>>  
>> browser.execute_script "window.confirm = function() { return true; }"
>>  
>> I get the following error:
>>  
>> WIN32OLERuntimeError: (in OLE method `execScript': )
>> OLE error code:80020101 in 
>>   Could not complete the operation due to error 80020101.
>> HRESULT error code:0x80020009
>>   Exception occurred.
>> from 
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/page-container.rb:29:in
>>  
>> `method_missing'
>> from 
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/page-container.rb:29:in
>>  
>> `rescue in execute_script'
>> from 
>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/page-container.rb:22:in
>>  
>> `execute_script'
>> from (irb):14
>> from C:/Ruby193/bin/irb:12:in `'
>>  
>> The following JavaScript errors are also present in the browser:
>>  
>> SCRIPT1014: Invalid character
>> *json2.js, line 1 character 1*
>>  
>> SCRIPT5009: 'JSON' is undefined 
>> *edit-location?pageTitle=Edit 
>> Location&contactId=8590307238&folderId=0&folderName=%5BGlobal%5D&cardId=8590242330,
>>  
>> line 1 character 1*
>>  
>> Jarmo, I performed the actions you suggested at Stack Overflow and got 
>> the following results:
>>  
>> >> typeof JSON
>> "undefined" 
>>  
>> >> typeof JSON.stringify 
>> "'JSON' is undefined" 
>>  
>> >> if (!window.JSON || !window.JSON.stringify) {
>> var json2=document.createElement('script');
>> json2.type='text/javascript';
>> json2.src='file:///C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-classic-3.3.0/lib/watir-classic/ext/json2.js';
>>  
>>
>> document.getElementsByTagName('head')[0].appendChild(json2)
>> } 
>> SCRIPT1014: Invalid character 
>> *json2.js, line 1 character 1* <https://groups.google.com/forum/0> 
>> [object] {
>> nextSibling : ,
>> onresizeend : null,
>> onrowenter : null,
>> aria-haspopup : "",
>> childNodes : [object],
>> ondragleave : null,
>> oncut : null,
>> clientHeight : 0,
>> onbeforepaste : null,
>> ondragover : null
>> ...
>> } 
>> Do you or anyone else have any further troubleshooting steps I can 
>> attempt?
>>  
>> Thanks!
>>
>

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[wtr-general] watir-classic issue with execute_script and JSON

2013-01-30 Thread captin
I have encountered an issue with execute_script using IE9 with ruby 
1.9.3p327 and watir-classic 3.4.0. I was doing some research and found my exact 
same issue detailed at Stack 
Overflow,
 
but the thread is stale (and I'm too new to be able to comment on the issue 
there). Jarmo was assisting but the OP hasn't responded in over three weeks.
 
I hate redundancy but I also hate waiting indefinitely so I figured I'd 
pose the question here. Using the following code:
 
browser.execute_script "window.confirm = function() { return true; }"
 
I get the following error:
 
WIN32OLERuntimeError: (in OLE method `execScript': )
OLE error code:80020101 in 
  Could not complete the operation due to error 80020101.
HRESULT error code:0x80020009
  Exception occurred.
from 
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/page-container.rb:29:in
 
`method_missing'
from 
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/page-container.rb:29:in
 
`rescue in execute_script'
from 
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.4.0/lib/watir-classic/page-container.rb:22:in
 
`execute_script'
from (irb):14
from C:/Ruby193/bin/irb:12:in `'
 
The following JavaScript errors are also present in the browser:
 
SCRIPT1014: Invalid character
*json2.js, line 1 character 1*
 
SCRIPT5009: 'JSON' is undefined 
*edit-location?pageTitle=Edit 
Location&contactId=8590307238&folderId=0&folderName=%5BGlobal%5D&cardId=8590242330,
 
line 1 character 1*
 
Jarmo, I performed the actions you suggested at Stack Overflow and got the 
following results:
 
>> typeof JSON
"undefined" 
 
>> typeof JSON.stringify 
"'JSON' is undefined" 
 
>> if (!window.JSON || !window.JSON.stringify) {
var json2=document.createElement('script');
json2.type='text/javascript';
json2.src='file:///C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-classic-3.3.0/lib/watir-classic/ext/json2.js';
 

document.getElementsByTagName('head')[0].appendChild(json2)
} 
SCRIPT1014: Invalid character 
*json2.js, line 1 character 1*  
[object] {
nextSibling : ,
onresizeend : null,
onrowenter : null,
aria-haspopup : "",
childNodes : [object],
ondragleave : null,
oncut : null,
clientHeight : 0,
onbeforepaste : null,
ondragover : null
...
} 
Do you or anyone else have any further troubleshooting steps I can attempt?
 
Thanks!

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[wtr-general] Re: query

2013-01-30 Thread captin
gem -v watir
 

On Wednesday, January 30, 2013 11:56:49 AM UTC-6, mc060200778 wrote:

> How do i check version of my installed watir?
>
>
>
> Thanks
>

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[wtr-general] Re: Unable to acces text_field inside a frame coz of some "#document" tag in the HTML.

2013-01-23 Thread captin
Without seeing your code, it's hard to know exactly what you tried. The 
following should allow you to access the text field:
 
browser.frame(:name, 'centent').text_field(:id, 
'').flash
 

On Wednesday, January 23, 2013 8:38:33 AM UTC-6, Deepak Kumar wrote:

> Hi everyone,
> I am trying to access a text_field of page.HTML format is as follows
>
> 
>   -
> 
>   
>*  #document*
>
> -
> 
>  --
> 
> < div class="utilityNavHome" id="utilityNavHome">
> 
>
> i tried through IRB and tried to us flash() function but can only use the 
> function on Iframe tag after that i am not able to acess any element.
> Is "#document" creating a problem.
>
> Thanks & regards
> Deepak Kumar
>  
>
>

-- 
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: Undefined method 'javascript_dialog' using Watir 4.0.2/Ruby 1.9.3

2013-01-18 Thread captin
Thank you gents. The Watir::Alert objects are exactly what I needed. Only 
downside is that I have to switch to watir-classic from the standard watir, 
since I'm testing primarily in IE. So far there aren't any side effects. 
*fingers crossed*
 
And thanks for your continued help. This is one of the most supportive 
communities I've dealt with.
 
 
On Friday, January 18, 2013 6:22:45 AM UTC-6, Jarmo Pertman wrote:

> As Dan mentioned - use the JavaScript dialogs API. Use the #alert method (
> http://rubydoc.info/github/watir/watir-classic/Watir/Container:alert) and 
> then appropriate Alert (
> http://rubydoc.info/github/watir/watir-classic/Watir/Alert) methods.
>
> Jarmo Pertman
> -
> IT does really matter - http://itreallymatters.net
>
>
> On Friday, January 18, 2013 2:49:05 AM UTC+2, Dan wrote:
>>
>> There's a better way to do it now.  Check this out:
>>
>> http://watirwebdriver.com/javascript-dialogs/
>>
>> On Thursday, January 17, 2013 5:54:10 PM UTC-5, captin wrote:
>>>
>>> I've searched all over this user group and the web and can't find an 
>>> answer to my issue. I'm attempting to use the 'javascript_dialog' 
>>> method to access alert windows. It's my understanding that this capability 
>>> is supposed to be included in the standard watir (at least it once 
>>> was according to information like 
>>> this<http://stackoverflow.com/questions/8164039/handling-a-javascript-popup-occurring-on-a-keyup-event/8172888#8172888>).
>>>  
>>> I am trying to determine if this functionality has been deprecated or if I 
>>> might have an issue with my configuration. If it has been deprecated, is 
>>> there a better way to achieve what I'm trying to through watir-webdriver or 
>>> watir-classic?
>>>  
>>> Thanks in advance!
>>>  
>>> Ruby version: ruby 1.9.3p327 (2012-11-10) [i386-mingw32]
>>>  
>>> *** LOCAL GEMS ***
>>> addressable (2.3.2)
>>> bigdecimal (1.1.0)
>>> builder (3.1.4)
>>> childprocess (0.3.6)
>>> commonwatir (4.0.0)
>>> diff-lcs (1.1.3)
>>> 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)
>>> rspec (2.12.0)
>>> rspec-core (2.12.2)
>>> rspec-expectations (2.12.1)
>>> rspec-mocks (2.12.0)
>>> rubyzip (0.9.9)
>>> s4t-utils (1.0.4)
>>> selenium-webdriver (2.26.0)
>>> subexec (0.0.4)
>>> syntax (1.0.0)
>>> 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)
>>>
>>

-- 
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] Undefined method 'javascript_dialog' using Watir 4.0.2/Ruby 1.9.3

2013-01-17 Thread captin
I've searched all over this user group and the web and can't find an answer 
to my issue. I'm attempting to use the 'javascript_dialog' method to access 
alert windows. It's my understanding that this capability is supposed to be 
included in the standard watir (at least it once was according to 
information like 
this).
 
I am trying to determine if this functionality has been deprecated or if I 
might have an issue with my configuration. If it has been deprecated, is 
there a better way to achieve what I'm trying to through watir-webdriver or 
watir-classic?
 
Thanks in advance!
 
Ruby version: ruby 1.9.3p327 (2012-11-10) [i386-mingw32]
 
*** LOCAL GEMS ***
addressable (2.3.2)
bigdecimal (1.1.0)
builder (3.1.4)
childprocess (0.3.6)
commonwatir (4.0.0)
diff-lcs (1.1.3)
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)
rspec (2.12.0)
rspec-core (2.12.2)
rspec-expectations (2.12.1)
rspec-mocks (2.12.0)
rubyzip (0.9.9)
s4t-utils (1.0.4)
selenium-webdriver (2.26.0)
subexec (0.0.4)
syntax (1.0.0)
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)

-- 
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

2012-12-19 Thread captin
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 
> 
> > 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

2012-12-19 Thread captin
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] Failed 'assert' statement doesn't get rescued

2012-12-19 Thread captin
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