[wtr-general] Re: Problems using visible

2008-10-29 Thread Tony

ahh ... forgot about the visibility attribute. :)
The below is the updated code

def visible?
 jssh_command = var val = 'true'; var str = ''; var obj =
#{element_object}; while (obj != null) { try { str =
document.defaultView.getComputedStyle(obj,null).visibility; if
(str=='hidden') { val = 'false'; break; } str =
#{DOCUMENT_VAR}.defaultView.getComputedStyle(obj,null).display; if
(str=='none') { val = 'false'; break; }  } catch(err) {} obj =
obj.parentNode; } val;

 jssh_socket.send(#{jssh_command}\n, 0)
 vals = read_socket()
 return (vals == 'false')? false: true
end
public:visible?

-Tony
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: How to access a child object

2008-10-29 Thread bugs apple
Hi, lanok and all

In order to test on this method, I have appended this html code on Web page

Object id=flexapp, onClick = javascript:alert('This is an alert box');
click me

br


And then, i execute the watir code ie.object(:id, 'flexApp').click,

the stdout throw an exception like this,
D:\watirlib\watirlib\lib\pwatir\lib/watir/element.rb:56:in `assert_exists':
Unable to locate element, using :id, flexApp
(Watir::Exception::UnknownObjectException)
from D:\watirlib\watirlib\lib\pwatir\lib/watir/element.rb:288:in
`enabled?'
from D:\watirlib\watirlib\lib\pwatir\lib/watir/element.rb:60:in
`assert_enabled'
from D:\watirlib\watirlib\lib\pwatir\lib/watir/element.rb:233:in
`click!'
from D:\watirlib\watirlib\lib\pwatir\lib/watir/element.rb:219:in
`click'
from D:/watirlib/watirlib/lib/main.rb:58

Still have another modification for watir api?



2008/10/28 LanOK [EMAIL PROTECTED]


 I think it's useful to know, how to define a new element.
 In following example I define an element with tag-name OBJECT
 thank you LFIdnl for idea

 module Watir
  def object(how, what)
return Object.new(self, how, what)
  end
  def objects
return Objects.new(self)
  end
  class Object  NonControlElement
TAG = 'OBJECT'
  end
  class Objects  ElementCollections
include CommonCollection
def element_class; Object; end
def element_tag; 'OBJECT'; end
  end
 end
  


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Three Questiong for Watir developers

2008-10-29 Thread bugs apple
Sorry for confusing,

The IE.each was fail , when the IE was called as internet explorer for
window.path
since window.path =~ /Internet Explorer/ is not treated the case sentive.

I changed it as (File.basename(window.fullname).downcase =~ /iexplore.exe/
instead of the former. I want to suggest that it be applied for watir
api?and  I am afraid that it have another bad effect that i have not
evaluated?


Both two methods were fail at same times, when you open the (
http://images.china-pub.com/ebook30001-35000/34807/ch12.pdf as an IE alive
instance, which result in the IE.each can 't  work at all.

have some one run into the same issue?

Thanks.
-Wiston



 def self.each
   shell = WIN32OLE.new('Shell.Application')
   shell.Windows.each do |window|
 next unless (window.path =~ /Internet Explorer/ rescue false)
 next unless (hwnd = window.hwnd rescue false)
 ie = IE.bind(window)
 ie.hwnd = hwnd
 yield ie
   end
 end


2008/10/27 Bret Pettichord [EMAIL PROTECTED]


 Wiston,

 You said the IE.each method was failing in certain circumstances. Can
 you give us more information about the circumstances in which it was
 failing?

 Also in your report you said that you changed window.path (changing the
 case), but the code you provided actually changed to using
 window.fullname. So your explanation does not match the code example you
 provided.

 I would like to understand more about the problem you've been
 researching so we can provide an adequate solution.

 Bret


 bugs apple wrote:
  Hi,  Bret and all
 
  Last week, we found the method Watir::IE.each was not always work
  normally, sometimes it could enter into the
  sub routine, sometimes faild.
 
  its code list as below in ie.rb
 
  def self.each
shell = WIN32OLE.new('Shell.Application')
shell.Windows.each do |window|
  next unless (window.path =~ /Internet Explorer/ rescue false)
  next unless (hwnd = window.hwnd rescue false)
  ie = IE.bind(window)
  ie.hwnd = hwnd
  yield ie
end
  end
 
 
  After debug every line code, and discovery this code window.path =~
  /Internet Explorer/ return false, I have to puts the
  window.path, and obviously it return true when window.path =~
  /internet Explorer/. there is difference between the Internet and
  internet.
  so, we change the code like below in order to make the IE.each method
  works
 
  def self.eachie
shell = WIN32OLE.new('Shell.Application')
shell.Windows.each do |window|
  next unless (File.basename(window.fullname).downcase =~
  /iexplore/ rescue false)
  next unless (hwnd = window.hwnd rescue false)
  ie = IE.bind(window)
  ie.hwnd = hwnd
  yield ie
end
  end
 
  The question is that I want to consult with you all and hope get your
  analysis if the modified method cover all IE windows instance, and i
  can always make the Watir::IE.eachie
  work, or have any bad effect for others i can't evaluate?
 


 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Problems using visible

2008-10-29 Thread Tony

Was running the tests for some time .. and suddenly i started getting
wrong results for visible.
Look like the #{element_object} was returning null sometimes. Dont
know why
Started working after adding assert_exists
Heres the updated code -

class Element
def visible?
 assert_exists
 jssh_command = var val = 'true'; var str = ''; var obj =
#{element_object}; while (obj != null) { try { str =
document.defaultView.getComputedStyle(obj,null).visibility; if
(str=='hidden') { val = 'false'; break; } str =
#{DOCUMENT_VAR}.defaultView.getComputedStyle(obj,null).display; if
(str=='none') { val = 'false'; break; }  } catch(err) {} obj =
obj.parentNode; } val;
 jssh_socket.send(#{jssh_command}\n, 0)
 vals = read_socket()
 return (vals == 'false')? false: true
end
public:visible?
end


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Watir and TeamCity

2008-10-29 Thread al3kc

Did anyone try to integrate Watir scripts with TeamCity continuous
build system? Is there way TeamCity to kick off Watir scripts
automatically?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Watir and TeamCity

2008-10-29 Thread aidy lewis

2008/10/29 al3kc [EMAIL PROTECTED]:

 Did anyone try to integrate Watir scripts with TeamCity continuous
 build system? Is there way TeamCity to kick off Watir scripts
 automatically?

1) Must run from interactive session
2) Team city rake runner is experimental
3) Fair a bit of setup (FireWatir, additional gems etc)

Aidy

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Problems using visible

2008-10-29 Thread Bret Pettichord

I opened up a ticket with your suggestion. Would you mind updating it 
with your latest code?
http://jira.openqa.org/browse/WTR-262


Tony wrote:
 Was running the tests for some time .. and suddenly i started getting
 wrong results for visible.
 Look like the #{element_object} was returning null sometimes. Dont
 know why
 Started working after adding assert_exists
 Heres the updated code -

 class Element
 def visible?
  assert_exists
  jssh_command = var val = 'true'; var str = ''; var obj =
 #{element_object}; while (obj != null) { try { str =
 document.defaultView.getComputedStyle(obj,null).visibility; if
 (str=='hidden') { val = 'false'; break; } str =
 #{DOCUMENT_VAR}.defaultView.getComputedStyle(obj,null).display; if
 (str=='none') { val = 'false'; break; }  } catch(err) {} obj =
 obj.parentNode; } val;
  jssh_socket.send(#{jssh_command}\n, 0)
  vals = read_socket()
  return (vals == 'false')? false: true
 end
 public:visible?
 end


 
   


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Problems using visible

2008-10-29 Thread Paul Rogers

for people in the future searching the archives, its also worth noting
that visible? has some other problems. The app i work on 'hides' stuff
from the user by moving it to coordinates -1000, -1000. THis way the
thing is still in the dom, and can be made to appear quicker by
changing its coordinates.

So ive modified my visible? methods accordingly

Paul

On Wed, Oct 29, 2008 at 8:35 AM, Bret Pettichord [EMAIL PROTECTED] wrote:

 I opened up a ticket with your suggestion. Would you mind updating it
 with your latest code?
 http://jira.openqa.org/browse/WTR-262


 Tony wrote:
 Was running the tests for some time .. and suddenly i started getting
 wrong results for visible.
 Look like the #{element_object} was returning null sometimes. Dont
 know why
 Started working after adding assert_exists
 Heres the updated code -

 class Element
 def visible?
  assert_exists
  jssh_command = var val = 'true'; var str = ''; var obj =
 #{element_object}; while (obj != null) { try { str =
 document.defaultView.getComputedStyle(obj,null).visibility; if
 (str=='hidden') { val = 'false'; break; } str =
 #{DOCUMENT_VAR}.defaultView.getComputedStyle(obj,null).display; if
 (str=='none') { val = 'false'; break; }  } catch(err) {} obj =
 obj.parentNode; } val;
  jssh_socket.send(#{jssh_command}\n, 0)
  vals = read_socket()
  return (vals == 'false')? false: true
 end
 public:visible?
 end


 



 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Watir does not work with Orkut JS hacks

2008-10-29 Thread sergio . soujava


Here is a simple source code to log into orkut.

You simply cannot find any links or anything because the document
retains the JavaScript code, not the actual JavaScript result.

See ie.html below to understand what I am talking about.

Is there anyway to make the Watir document gets updated with whatever
is showing in the browser? That sounds like a silly/non-sense
question, but that's exactly what is happening. :-(

require 'watir'

test_site = 'http://www.orkut.com'

ie = Watir::IE.new

ie.goto(test_site)

sleep 1

ie.text_field(:name, 'Email').set('[EMAIL PROTECTED]')
ie.text_field(:name, 'Passwd').set('abc123')
ie.button(:name, signIn).click

sleep 5

puts ie.text

puts

puts ie.html

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Watir does not work with Orkut JS hacks

2008-10-29 Thread Sergio Oliveira
To make my point more clear, look what show_all_objects is printing:

---Objects in page -
image/x-icon  id=
text/javascript   id= src=
text/css  id=
text/javascript   id= src=
http://img1.orkut.com/js/gen/common040.js
text/javascript   id= src=
http://img2.orkut.com/js/gen/in_frame014.js
  id= src=
text/javascript   id= src=
HTML Document name=orkutFrame id=orkutFrame   src=
  id= src=
text  name=history_state0  id=history_state0   value=Home.aspx
  alt=src=
HTML Document name=   id=history_iframe0  src=

-Sergio

On Wed, Oct 29, 2008 at 8:45 PM, [EMAIL PROTECTED] wrote:



 Here is a simple source code to log into orkut.

 You simply cannot find any links or anything because the document
 retains the JavaScript code, not the actual JavaScript result.

 See ie.html below to understand what I am talking about.

 Is there anyway to make the Watir document gets updated with whatever
 is showing in the browser? That sounds like a silly/non-sense
 question, but that's exactly what is happening. :-(

 require 'watir'

 test_site = 'http://www.orkut.com'

 ie = Watir::IE.new

 ie.goto(test_site)

 sleep 1

 ie.text_field(:name, 'Email').set('[EMAIL PROTECTED]')
 ie.text_field(:name, 'Passwd').set('abc123')
 ie.button(:name, signIn).click

 sleep 5

 puts ie.text

 puts

 puts ie.html

 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Watir does not work with Orkut JS hacks

2008-10-29 Thread Jared Quinert

You might be able to get something done by accessing the ie document 
directly.  I have some examples here:

http://www.software-testing.com.au/blog/index.php?itemid=49

Have you tried any other tools on your app?  This may be as much a 
lesson in testability as a tooling problem :-(

Jared

http://www.quinert.com/blog/

Sergio Oliveira wrote:
 To make my point more clear, look what show_all_objects is printing:


 ---Objects in page -
 image/x-icon  id=
 text/javascript   id= src=
 text/css  id=
 text/javascript   id= 
 src=http://img1.orkut.com/js/gen/common040.js
 text/javascript   id= 
 src=http://img2.orkut.com/js/gen/in_frame014.js
   id= src=
 text/javascript   id= src=
 HTML Document name=orkutFrame id=orkutFrame   src=
   id= src=
 text  name=history_state0  id=history_state0   
 value=Home.aspx alt=src=
 HTML Document name=   id=history_iframe0  src=

 -Sergio

 On Wed, Oct 29, 2008 at 8:45 PM, [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:



 Here is a simple source code to log into orkut.

 You simply cannot find any links or anything because the document
 retains the JavaScript code, not the actual JavaScript result.

 See ie.html below to understand what I am talking about.

 Is there anyway to make the Watir document gets updated with whatever
 is showing in the browser? That sounds like a silly/non-sense
 question, but that's exactly what is happening. :-(

 require 'watir'

 test_site = 'http://www.orkut.com'

 ie = Watir::IE.new

 ie.goto(test_site)

 sleep 1

 ie.text_field(:name, 'Email').set('[EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]')
 ie.text_field(:name, 'Passwd').set('abc123')
 ie.button(:name, signIn).click

 sleep 5

 puts ie.text

 puts

 puts ie.html




 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Watir does not work with Orkut JS hacks

2008-10-29 Thread Sergio Oliveira
Thanks for your help, Jared!
I did some progress as well. I think we are missing an important feature in
Watir.

The problem is that Orkut is dynamically creating an IFRAME. I was able to
get the document (WIN32OLE) for this iframe.

Now comes the missing feature:

How do I switch the document inside Watir Container to the document of
another frame or iframe?

Maybe we already have such a method and i am not aware of.

Thanks,

-Sergio

On Wed, Oct 29, 2008 at 11:20 PM, Jared Quinert [EMAIL PROTECTED] wrote:


 You might be able to get something done by accessing the ie document
 directly.  I have some examples here:

 http://www.software-testing.com.au/blog/index.php?itemid=49

 Have you tried any other tools on your app?  This may be as much a
 lesson in testability as a tooling problem :-(

 Jared

 http://www.quinert.com/blog/

 Sergio Oliveira wrote:
  To make my point more clear, look what show_all_objects is printing:
 
 
  ---Objects in page -
  image/x-icon  id=
  text/javascript   id= src=
  text/css  id=
  text/javascript   id=
  src=http://img1.orkut.com/js/gen/common040.js
  text/javascript   id=
  src=http://img2.orkut.com/js/gen/in_frame014.js
id= src=
  text/javascript   id= src=
  HTML Document name=orkutFrame id=orkutFrame   src=
id= src=
  text  name=history_state0  id=history_state0
  value=Home.aspx alt=src=
  HTML Document name=   id=history_iframe0  src=
 
  -Sergio
 
  On Wed, Oct 29, 2008 at 8:45 PM, [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
 
 
 
  Here is a simple source code to log into orkut.
 
  You simply cannot find any links or anything because the document
  retains the JavaScript code, not the actual JavaScript result.
 
  See ie.html below to understand what I am talking about.
 
  Is there anyway to make the Watir document gets updated with whatever
  is showing in the browser? That sounds like a silly/non-sense
  question, but that's exactly what is happening. :-(
 
  require 'watir'
 
  test_site = 'http://www.orkut.com'
 
  ie = Watir::IE.new
 
  ie.goto(test_site)
 
  sleep 1
 
  ie.text_field(:name, 'Email').set('[EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED]')
  ie.text_field(:name, 'Passwd').set('abc123')
  ie.button(:name, signIn).click
 
  sleep 5
 
  puts ie.text
 
  puts
 
  puts ie.html
 
 
 
 
  


 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Watir does not work with Orkut JS hacks

2008-10-29 Thread wesley chen
You just need use focus, such as:
ie.frame(:id, //).document.body.focus
ie.send_keys(...)


Wesley
Man should be hard to himself, but tolerant to others.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---