[wtr-general] Error using watir when trying to run a web testing

2009-06-19 Thread Pato Coronel

Hi!
I'm new with Watir and Ruby. I'm trying to learn to use the tool and
to program using Ruby too...
I have a laptop with Windows Vista and using Ruby-186-26.
The only thing I have done is to copy an example about a google search
using SctIE editor and saving it with .rb extension.
This is the code:

#-#
# Demo test for the Watir controller.
#
# Purpose: to demonstrate the following Watir functionality:
#   * entering text into a text field,
#   * clicking a button,
#   * checking to see if a page contains text.
# Test will search Google for the pickaxe Ruby book.
#-#

# the Watir controller
require watir

# set a variable
test_site = http://www.google.com;

# open a browser
browser = Watir::Browser.new

# print some comments
puts Beginning of test: Google search.

puts  Step 1: go to the test site:  + test_site
browser.goto test_site

puts  Step 2: enter 'pickaxe' in the search text field.
browser.text_field(:name, q).set pickaxe # q is the name of the
search field

puts  Step 3: click the 'Google Search' button.
browser.button(:name, btnG).click # btnG is the name of the Search
button

puts  Expected Result:
puts   A Google page with results should be shown. 'Programming Ruby'
should be high on the list.

puts  Actual Result:
if browser.text.include? Programming Ruby
  puts   Test Passed. Found the test string: 'Programming Ruby'.
Actual Results match Expected Results.
else
  puts   Test Failed! Could not find: 'Programming Ruby'.
end

puts End of test: Google search.

The problem is that when executing this code, I got the following
error:

C:\Users\Pato\Documentsruby pruebaruby.rb
Beginning of test: Google search.
 Step 1: go to the test site: http://www.google.com
 Step 2: enter 'pickaxe' in the search text field.
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:52:in
`assert_ex
ists': Unable to locate element, using :name,
q (Watir::Exception::UnknownObje
ctException)
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
element.rb:284
:in `enabled?'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
element.rb:56:
in `assert_enabled'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
input_elements
.rb:323:in `set'
from pruebaruby.rb:27

At the same time it is executing, the new window of the browser is
opened as requested in the code, but it is a blank window and a
message is displayed about security in the zones are different so it
is necessary to open the url in a different window. Then a new second
browser window is opened and the code stops to respond and the pasted
error message is displayed.
I have verified the IE browser properties and there is something
calling my attention:
The first window browser that the codes open says Protected mode
deactivated
The second one that it is displayed after confirming the security
message says Protected mode activated
I think that I have any property in the IE that it is not working
fine. I have set the security properties to the default value and this
didn't solve the issue.
Could someone help me to solve this? I'm new with this and don't know
how to solve it.
Thanks a lot!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Error using watir when trying to run a web testing

2009-06-19 Thread ryan li
This code is from example of openqa.org, I just ran the code without problem
( WinXp+IE6), so I think it might related with Vista or IE(7?)'s setting.



-r



On Fri, Jun 19, 2009 at 11:00 AM, Pato Coronel patriciacoro...@gmail.comwrote:


 Hi!
 I'm new with Watir and Ruby. I'm trying to learn to use the tool and
 to program using Ruby too...
 I have a laptop with Windows Vista and using Ruby-186-26.
 The only thing I have done is to copy an example about a google search
 using SctIE editor and saving it with .rb extension.
 This is the code:

 #-#
 # Demo test for the Watir controller.
 #
 # Purpose: to demonstrate the following Watir functionality:
 #   * entering text into a text field,
 #   * clicking a button,
 #   * checking to see if a page contains text.
 # Test will search Google for the pickaxe Ruby book.
 #-#

 # the Watir controller
 require watir

 # set a variable
 test_site = http://www.google.com;

 # open a browser
 browser = Watir::Browser.new

 # print some comments
 puts Beginning of test: Google search.

 puts  Step 1: go to the test site:  + test_site
 browser.goto test_site

 puts  Step 2: enter 'pickaxe' in the search text field.
 browser.text_field(:name, q).set pickaxe # q is the name of the
 search field

 puts  Step 3: click the 'Google Search' button.
 browser.button(:name, btnG).click # btnG is the name of the Search
 button

 puts  Expected Result:
 puts   A Google page with results should be shown. 'Programming Ruby'
 should be high on the list.

 puts  Actual Result:
 if browser.text.include? Programming Ruby
  puts   Test Passed. Found the test string: 'Programming Ruby'.
 Actual Results match Expected Results.
 else
  puts   Test Failed! Could not find: 'Programming Ruby'.
 end

 puts End of test: Google search.

 The problem is that when executing this code, I got the following
 error:

 C:\Users\Pato\Documentsruby pruebaruby.rb
 Beginning of test: Google search.
  Step 1: go to the test site: http://www.google.com
  Step 2: enter 'pickaxe' in the search text field.
 c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:52:in
 `assert_ex
 ists': Unable to locate element, using :name,
 q (Watir::Exception::UnknownObje
 ctException)
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
 element.rb:284
 :in `enabled?'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
 element.rb:56:
 in `assert_enabled'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
 input_elements
 .rb:323:in `set'
from pruebaruby.rb:27

 At the same time it is executing, the new window of the browser is
 opened as requested in the code, but it is a blank window and a
 message is displayed about security in the zones are different so it
 is necessary to open the url in a different window. Then a new second
 browser window is opened and the code stops to respond and the pasted
 error message is displayed.
 I have verified the IE browser properties and there is something
 calling my attention:
 The first window browser that the codes open says Protected mode
 deactivated
 The second one that it is displayed after confirming the security
 message says Protected mode activated
 I think that I have any property in the IE that it is not working
 fine. I have set the security properties to the default value and this
 didn't solve the issue.
 Could someone help me to solve this? I'm new with this and don't know
 how to solve it.
 Thanks a lot!

 



-- 
Best Regards, Let me know if I can help.

Ray
---
Enrich your cube life
www.myvpsoft.com
www.3wgift.com
screenshots:  http://picasaweb.google.com/sunraise2005

Get our FTP Account:
http://61.152.188.156:880/viewthread.php?tid=11extra=page%3D1


+01-(408)556-9618

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Error using watir when trying to run a web testing

2009-06-19 Thread Ye Jian
The code without problem on my mahcine(winxp+IE7).

2009-06-19 



QA Manager
Ufinity/QA department
Email: j...@cn.ufinity.com | Web: www.ufinity.com | MSN:ahyej...@hotmail.com
Tel:0551-5312050,5312060-805
Address: 605 #317/318/319 Huangshan Road,HeFei City,An Hui Province 



发件人: ryan li 
发送时间: 2009-06-19  14:59:09 
收件人: watir-general 
抄送: 
主题: [wtr-general] Re: Error using watir when trying to run a web testing 
  
This code is from example of openqa.org, I just ran the code without problem ( 
WinXp+IE6), so I think it might related with Vista or IE(7?)'s setting.  



-r




On Fri, Jun 19, 2009 at 11:00 AM, Pato Coronel patriciacoro...@gmail.com 
wrote:


Hi!
I'm new with Watir and Ruby. I'm trying to learn to use the tool and
to program using Ruby too...
I have a laptop with Windows Vista and using Ruby-186-26.
The only thing I have done is to copy an example about a google search
using SctIE editor and saving it with .rb extension.
This is the code:

#-#
# Demo test for the Watir controller.
#
# Purpose: to demonstrate the following Watir functionality:
#   * entering text into a text field,
#   * clicking a button,
#   * checking to see if a page contains text.
# Test will search Google for the pickaxe Ruby book.
#-#

# the Watir controller
require watir

# set a variable
test_site = http://www.google.com;

# open a browser
browser = Watir::Browser.new

# print some comments
puts Beginning of test: Google search.

puts  Step 1: go to the test site:  + test_site
browser.goto test_site

puts  Step 2: enter 'pickaxe' in the search text field.
browser.text_field(:name, q).set pickaxe # q is the name of the
search field

puts  Step 3: click the 'Google Search' button.
browser.button(:name, btnG).click # btnG is the name of the Search
button

puts  Expected Result:
puts   A Google page with results should be shown. 'Programming Ruby'
should be high on the list.

puts  Actual Result:
if browser.text.include? Programming Ruby
 puts   Test Passed. Found the test string: 'Programming Ruby'.
Actual Results match Expected Results.
else
 puts   Test Failed! Could not find: 'Programming Ruby'.
end

puts End of test: Google search.

The problem is that when executing this code, I got the following
error:

C:\Users\Pato\Documentsruby pruebaruby.rb
Beginning of test: Google search.
 Step 1: go to the test site: http://www.google.com
 Step 2: enter 'pickaxe' in the search text field.
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:52:in
`assert_ex
ists': Unable to locate element, using :name,
q (Watir::Exception::UnknownObje
ctException)
   from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
element.rb:284
:in `enabled?'
   from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
element.rb:56:
in `assert_enabled'
   from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
input_elements
.rb:323:in `set'
   from pruebaruby.rb:27

At the same time it is executing, the new window of the browser is
opened as requested in the code, but it is a blank window and a
message is displayed about security in the zones are different so it
is necessary to open the url in a different window. Then a new second
browser window is opened and the code stops to respond and the pasted
error message is displayed.
I have verified the IE browser properties and there is something
calling my attention:
The first window browser that the codes open says Protected mode
deactivated
The second one that it is displayed after confirming the security
message says Protected mode activated
I think that I have any property in the IE that it is not working
fine. I have set the security properties to the default value and this
didn't solve the issue.
Could someone help me to solve this? I'm new with this and don't know
how to solve it.
Thanks a lot!






-- 
Best Regards, Let me know if I can help.

Ray
---
Enrich your cube life 
www.myvpsoft.com
www.3wgift.com
screenshots:  http://picasaweb.google.com/sunraise2005

Get our FTP Account:  
http://61.152.188.156:880/viewthread.php?tid=11extra=page%3D1


+01-(408)556-9618


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Error using watir when trying to run a web testing

2009-06-19 Thread Željko Filipin
On Fri, Jun 19, 2009 at 5:00 AM, Pato Coronel patriciacoro...@gmail.com
wrote:
 At the same time it is executing, the new window of the browser is
 opened as requested in the code, but it is a blank window and a
 message is displayed about security in the zones are different so it
 is necessary to open the url in a different window.

It looks to me that you have to adjust Internet Explorer settings to it does
not care about security zones. Try lowering security.

Željko
--
http://watirpodcast.com/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Error using watir when trying to run a web testing

2009-06-19 Thread ryan li
the quickest way might be add http://*.google.com to safe site.

-r

On Fri, Jun 19, 2009 at 4:10 PM, Željko Filipin 
zeljko.fili...@wa-research.ch wrote:

 On Fri, Jun 19, 2009 at 5:00 AM, Pato Coronel patriciacoro...@gmail.com
 wrote:
  At the same time it is executing, the new window of the browser is
  opened as requested in the code, but it is a blank window and a
  message is displayed about security in the zones are different so it
  is necessary to open the url in a different window.

 It looks to me that you have to adjust Internet Explorer settings to it
 does not care about security zones. Try lowering security.

 Željko
 --
 http://watirpodcast.com/


 



-- 
Best Regards, Let me know if I can help.

Ray
---
Enrich your cube life
www.myvpsoft.com
www.3wgift.com
screenshots:  http://picasaweb.google.com/sunraise2005

Get our FTP Account:
http://61.152.188.156:880/viewthread.php?tid=11extra=page%3D1


+01-(408)556-9618

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Setting HTML Properties

2009-06-19 Thread al3kc


Try

ie.table(:index,1).document.style.display = 'block'

It works for me on IE, not sure about FF.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] [FireWatir] Received data in read_socket is empty

2009-06-19 Thread dottree

Now I'd like to click an image in a page by it's id, but sometimes it
returns empty value to me when the image is actually existing (error
raised in MozillaBaseElement.rb:1117:in `click').

My script is something like: someframe.image(:id, someimg).click()

But when I go through the scripts in debug mode, the image can be
found. So I suspected whether it's caused by socket and tried to add
sleep in the location as following, the data can be received correctly
after that.

==container.rb
def read_socket(socket = jssh_socket)
 .
  while(s == nil) do
s = Kernel.select([socket] , nil , nil, 1)
  end

#  sleep 0.2  # added sleep

  for stream in [socket]
data = stream.recv(1024)  #here data is empty when sleep not
added
..

Have any ideas about it?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Received data in read_socket is empty

2009-06-19 Thread jason

as you have worked out already - it looks like a timing problem - this
normally happens when the page has not finished loading.

this is because the wait method looks for isLoadingDocument when it
should be looking for webProgress.busyFlags

hope that helps.

jason.


On 19 Jun., 12:43, dottree yuanchun.l...@gmail.com wrote:
 Now I'd like to click an image in a page by it's id, but sometimes it
 returns empty value to me when the image is actually existing (error
 raised in MozillaBaseElement.rb:1117:in `click').

 My script is something like: someframe.image(:id, someimg).click()

 But when I go through the scripts in debug mode, the image can be
 found. So I suspected whether it's caused by socket and tried to add
 sleep in the location as following, the data can be received correctly
 after that.

 ==container.rb
 def read_socket(socket = jssh_socket)
      .
       while(s == nil) do
         s = Kernel.select([socket] , nil , nil, 1)
       end

 #      sleep 0.2  # added sleep

       for stream in [socket]
         data = stream.recv(1024)  #here data is empty when sleep not
 added
 ..

 Have any ideas about it?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] can I force javascripts links when clicked to load in a new window

2009-06-19 Thread jason

Hi all,

Using firewatir, do you know if I can force javascripts links when
clicked to load in a new window.

ff.goto(someurl)

ff.link(:index, 1).click  #assuming that it has a javascript
function call in the href

I would love that click to open a new window and load the result of
the javascript function call.

(i.e. the same sort of option when you get with a right mouse click on
a link and firefox asks you if you want to open the link in a new tab
or a new window).

any ideas??

thanks a million.

Jason.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Watir like test tool for windows-applications

2009-06-19 Thread Richard Wijdenes

Zhimin,

thank you for the info! It looks promising

Richard


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: firewatir attach() issue

2009-06-19 Thread orde

This works in IE:

#
require 'watir'

b = Watir::IE.start('http://www.webdevelopersnotes.com/tutorials/
javascript/creating_opening_new_window_pop_ups_javascript.php3')
b.link(:text=/Open a new window/).click
b1=Watir::IE.attach(:title,/Welcome/)
puts b1.title
#

Hope that helps...

On Jun 19, 11:01 am, sHiVa krapa.ph...@gmail.com wrote:
 Hello all,

 My apologizes to all for posting this message even several threads are
 existed relevant to this topic.I am trying to attach a popup window
 using firewatir attach command but no luck.
 'NoMatchingWindowFoundException' is displayed.

 Here is my code:

 #--
 require 'firewatir'
 include FireWatir
 b=Firefox.new
 b.goto('http://www.webdevelopersnotes.com/tutorials/javascript/
 creating_opening_new_window_pop_ups_javascript.php3')
 sleep 6
 b.link(:text=/Open a new window/).click
 b1=b.attach(:title,/Welcome/)
 puts b1.text
 #-

 Please help regarding this
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: can I force javascripts links when clicked to load in a new window

2009-06-19 Thread orde

Hi Jason--

This thread might help:
http://groups.google.com/group/watir-general/browse_thread/thread/d98426e73262f416/05db8fa64b6b8cd6?lnk=gstq=right+click+new+window#05db8fa64b6b8cd6

orde


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---