Re: [Wtr-general] How to verify if SPAN is visible

2006-12-20 Thread Angrez Singh

Hi Brad,

You can use "attribute_value" method to get the value of style attribute.
Then you can use regular expression for comparison.

Regards,
Angrez


On 12/21/06, Brad <[EMAIL PROTECTED]> wrote:


I'm a newbie and have been searching on how to verify if a SPAN element is
visible.  I tried different things without success.  Here is the HTML code
for when visible.

*

Here it is when hidden.

*

How do you check the 'visibility' parameter of 'style'?

Thanks,
Brad
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5879&messageID=16440#16440
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] Give a solution fo javascript popup

2006-12-20 Thread liucongying
I use ruby185-21 and watir-1.5.1.1127.gem, I want a solution fo js pop the web 
html is the one in watir \unittests\html ---JavascriptClick.html。
   So i hope someone can give me codes of watir to solve js popup,do not use 
aotoit! thanks
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5883&messageID=16456#16456
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] give a solution fo js popup

2006-12-20 Thread liucongying
I use ruby185-21 and watir-1.5.1.1127.gem, 
I want a solution fo js pop
the web html is  the one in watir \unittests\html ---JavascriptClick.html
the source code:


Alert Test

function disp_confirm()
{
testResult = document.getElementById('testResult');
if (confirm("Press a button.")) 
testResult.value = "You pressed the Confirm and OK 
button!";
else
testResult.value = "You pressed the Confirm and Cancel 
button!";
}
function disp_alert()
{
testResult = document.getElementById('testResult');
alert("Press OK")
testResult.value = "You pressed the Alert button!"
}





There are two basic methods for bringing up dialogs using 
javascript.


alert(message) -- Display message and OK 
button.



confirm(message) -- Display message and OK and 
Cancel buttons.
   

Results of dialogs:






So i hope someone can give me codes of watir to solve js popup,do not use 
aotoit!
thanks
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5882&messageID=16455#16455
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] clicking on popup after selecting an item in select list

2006-12-20 Thread vikash
ok, I get the answer in forum how to do this, here is the answer :

def jsAlert(button, waitTime = 3) 
w = WinClicker.new 
longName = $ie.dir.gsub("/" , "\\" ) 
shortName = w.getShortFileName(longName) 
c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button} 
#{waitTime} " 
puts "Starting #{c}" 
w.winsystem(c) 
w=nil 
end 

Then, before the button you want to click that generates the popup, add 
in: 
jsAlert("OK", 3) 
ie.button(:name, "woohoo").click # This is the button you want to 
click that generates the popup
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5857&messageID=16453#16453
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Executing javascript in 1.5

2006-12-20 Thread Bret Pettichord
Is there any reason why the run_script method should not be added to the 
main Watir distribution? Let's add a jira ticket for this, so it's on 
our list.

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Automating the running & reporting of watir tests

2006-12-20 Thread Paul Hammer


Hi Thomas,

I too am fairly new at using WATIR.  The approach I'm using is pretty simple 
to begin with:


1) I'm running on XP calling multiple WATIR tests from a batch file, where 
the output of each test is redirected and appended to a .log file.


2) I'm then using a RUBY class I copied off the web (and modified) that 
emails the contents of the .log file to interested parties.  Any errors are 
in the .log files.


3) Here the web site source code and the WATIR/ruby code are stored 
separately in source control because different people write the product code 
and test code (engineering vrs. QA).


Paul



From: <[EMAIL PROTECTED]>
Reply-To: wtr-general@rubyforge.org
To: 
Subject: [Wtr-general] Automating the running & reporting of watir tests
Date: Tue, 19 Dec 2006 15:34:34 -0500

Hi,

I just started using WATIR and fell in love at first sight.  I'm sure
what I'm trying to do has been done before, so I thought I'd throw a net
out here and see what I catch...

Our dev team is building a half-dozen different apps (WARs) that, as a
whole, will eventually replace a legacy application.  We've started
writing WATIR tests to check some of the individual WARs, but what I'm
hoping to do is get some advise on:

1) How do people schedule automatic execution of a bunch of
different WATIR tests, similar to Continuum might do.  Is everyone out
there writing their own cron + scripts?

2) Is there are pre-built "watir-harness" that will email
someone when a test doesn't run as expected?

3) Do people typically source control their WATIR tests along
side the code that's under test?  Or do they typically group all their
WATIR tests together in a separate project for
ease-of-reuse/ease-of-discovery purposes?

Thanks in advance!
Tom Vaughan

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


_
Find sales, coupons, and free shipping, all in one place!  MSN Shopping 
Sales & Deals 
http://shopping.msn.com/content/shp/?ctid=198,ptnrid=176,ptnrdata=200639


___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Commiting action on the objects with same tags.

2006-12-20 Thread Bret Pettichord

>
> ie.link(:id => /ID_OPEN_/, index => 2).click
>
> NameError: undefined local variable or method `index' for main:Object
>
This syntax only works with Watir 1.5
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] hi and help with some javascript

2006-12-20 Thread Paul Hammer

Vince,

Also, I think this page only has one modal, so I'm not facing the situation 
you had.

Paul


>From: Vince <[EMAIL PROTECTED]>
>Reply-To: wtr-general@rubyforge.org
>To: wtr-general@rubyforge.org
>Subject: Re: [Wtr-general] hi and help with some javascript
>Date: Tue, 19 Dec 2006 13:56:41 CST
>
>Paul,
>
> > Could you really have meant to write:
> >
> > "The links and inputs within those divs are NOT always on the page, ..."
>
>I really wish that was the case, but alas it is not. Using the sample AJAX 
>modal box page that I mentioned in my first reply, you can "find" the 
>buttons from the modal long before you click the link to fire up the box. 
>This is because the div that we are calling a modal box is always on the 
>page, but not always visible.
>
>See for yourself:
>
>require 'watir'
>ie = Watir::IE.new
>ie.goto("http://ajax.asp.net/ajaxtoolkit/ModalPopup/ModalPopup.aspx";)
>puts "Button 1: #{ie.buttons[1].name}"
>puts "Button 2: #{ie.buttons[2].name}"
>
>If you only have one on the page, you should have no problem clicking the 
>button, setting the modal, and submitting it. If you have multiple and need 
>to validate that the correct one is showing (as I do), than you have a long 
>day ahead of you...
>-
>Posted via Jive Forums
>http://forums.openqa.org/thread.jspa?threadID=5830&messageID=16328#16328
>___
>Wtr-general mailing list
>Wtr-general@rubyforge.org
>http://rubyforge.org/mailman/listinfo/wtr-general

_
Visit MSN Holiday Challenge for your chance to win up to $50,000 in Holiday 
cash from MSN today! 
http://www.msnholidaychallenge.com/index.aspx?ocid=tagline&locale=en-us

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] hi and help with some javascript

2006-12-20 Thread Paul Hammer

Vince,

I tried placing this line of code in my test, just to see what it would 
show:

puts "Button 1: [EMAIL PROTECTED]"

Below is the result.  It seems This item somehow isn't considerred a button.

Paul


Started
E
Finished in 20.889 seconds.

  1) Error:
test_CreateQuestion_1_1(TestAYN):
Watir::Exception::UnknownObjectException: Unable to locate object, using 
index a
nd 0
c:/Program 
Files/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1/./watir.rb:1928:in
`assert_exists'
(eval):2:in `name'
C:/cvs/server-qa/qa_tests/ruby/TestAYNAjax.rb:77:in 
`test_CreateQuestion_1_1
'

1 tests, 0 assertions, 0 failures, 1 errors


>From: Vince <[EMAIL PROTECTED]>
>Reply-To: wtr-general@rubyforge.org
>To: wtr-general@rubyforge.org
>Subject: Re: [Wtr-general] hi and help with some javascript
>Date: Tue, 19 Dec 2006 13:56:41 CST
>
>Paul,
>
> > Could you really have meant to write:
> >
> > "The links and inputs within those divs are NOT always on the page, ..."
>
>I really wish that was the case, but alas it is not. Using the sample AJAX 
>modal box page that I mentioned in my first reply, you can "find" the 
>buttons from the modal long before you click the link to fire up the box. 
>This is because the div that we are calling a modal box is always on the 
>page, but not always visible.
>
>See for yourself:
>
>require 'watir'
>ie = Watir::IE.new
>ie.goto("http://ajax.asp.net/ajaxtoolkit/ModalPopup/ModalPopup.aspx";)
>puts "Button 1: #{ie.buttons[1].name}"
>puts "Button 2: #{ie.buttons[2].name}"
>
>If you only have one on the page, you should have no problem clicking the 
>button, setting the modal, and submitting it. If you have multiple and need 
>to validate that the correct one is showing (as I do), than you have a long 
>day ahead of you...
>-
>Posted via Jive Forums
>http://forums.openqa.org/thread.jspa?threadID=5830&messageID=16328#16328
>___
>Wtr-general mailing list
>Wtr-general@rubyforge.org
>http://rubyforge.org/mailman/listinfo/wtr-general

_
Visit MSN Holiday Challenge for your chance to win up to $50,000 in Holiday 
cash from MSN today! 
http://www.msnholidaychallenge.com/index.aspx?ocid=tagline&locale=en-us

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] How to verify if SPAN is visible

2006-12-20 Thread Brad
I'm a newbie and have been searching on how to verify if a SPAN element is 
visible.  I tried different things without success.  Here is the HTML code for 
when visible.

*

Here it is when hidden.

*

How do you check the 'visibility' parameter of 'style'?

Thanks,
Brad
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5879&messageID=16440#16440
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] how to access an element whose html tag is

2006-12-20 Thread Bret Pettichord
Can you show us the HTML for a link that is disabled?

Bret
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Syntax for relative attributes

2006-12-20 Thread Bret Pettichord
John Lolis wrote:
> headline = $ie.div(:text, 'Pragmatic Version Control')
> link = $ie.link(:class => 'addtocart', :after? => headline) 
>
> Is this saying you want the link that comes after headline? Is there a 
> before? :)
>   
Yes, there would also be a 'before' option, plus some others
> *if* thats the case, my only problem with it is that it seems to not follow 
> the standard syntax of Watir (as i understand it).
>
> how about ie.link(:class,'addtocard').after(ie.div(:text,'Pragmatic Version 
> Control'))
>   
This couldn't quite work. Well, it would "work" but what it would do is 
return true or false based on whether the link was after the div. 
However the following could be implemented, and in fact was a proposal 
that i had considered earlier:

  link = ie.div(:text, 'Pragmatic Version Control').after.link(:class, 
'addtocard')


I think this is less intuitive and it would be somewhat harder to 
implement. That's why i came up with the other proposal, above.

Bret
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Commiting action on the objects with same tags.

2006-12-20 Thread Galina Maralina
Hello,

 

I am trying to implement something suggested in Watir FAQ for clicking on
the second link/image with same name. I get same error whatever I try. This
is Watir 1.4.

 

ie.image(:src => /arrows_round/, index => 2).click

NameError: undefined local variable or method `index' for main:Object



ie.link(:id => /ID_OPEN_/, index => 2).click

NameError: undefined local variable or method `index' for main:Object

 

Can anyone help me?

 

Galina.

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Syntax for relative attributes

2006-12-20 Thread John Lolis
headline = $ie.div(:text, 'Pragmatic Version Control')
link = $ie.link(:class => 'addtocart', :after? => headline) 

Is this saying you want the link that comes after headline? Is there a before? 
:)

*if* thats the case, my only problem with it is that it seems to not follow the 
standard syntax of Watir (as i understand it).

how about ie.link(:class,'addtocard').after(ie.div(:text,'Pragmatic Version 
Control'))
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5849&messageID=16433#16433
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Syntax for relative attributes

2006-12-20 Thread Bret Pettichord
Željko Filipin wrote:
> This would make sense to me (no question mark)
>
> link = $ie.link(:class => 'addtocart', :after => headline)
>
> "By convention, methods that answer questions (i.e. Array#empty? 
> returns *true* if the receiver is empty) end in question marks." 
> (http://www.ruby-lang.org/en/documentation/ruby-from-other-languages/ 
> )
>
> This is not a method, but this convention really makes sense to me, so 
> I expect anything that ends with question mark to return true or 
> false. Why did you use question mark?
Actually it is a method, but not obviously so.

A major structural change between Watir 1.4 and Watir 1.5 is that in 
1.5, these 'conventions' actually are methods. In other words, there is 
a deep similarity between

  link =  ($ie.links.collect {|l|  l.class_name == 'addtocart'))[0]

and

  link = $ie.link(:class_name => 'addtocart')

(In the case of :class, we map it to the Element#class_name method 
because Object#class is already taken.)

In other words, my proposal implicitly includes adding a method 
Element#after? that returns true or false based on the relation ship 
between self and the argument. That is why it has a question mark. But i 
can see that retaining the question mark in the attribute syntax may be 
confusing and will make it work without it too.

Bret

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Wait functionality in Watir ..need help

2006-12-20 Thread Bret Pettichord
Željko Filipin wrote:
> while true
>   break unless ie.text.include?("loading")
>   sleep 1
> end
This is a more concise way of doing the same thing:

  while (ie.text.include? 'loading') {sleep 1}
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Overriding UserAgent values in IE control

2006-12-20 Thread Paul Rogers
take a look at the win32/registry package - its installed as part of ruby, its 
easy to use, and you should be able to set the user agent before starting IE

Paul

- Original Message -
From: Stephen Welch <[EMAIL PROTECTED]>
Date: Wednesday, December 20, 2006 11:25 am
Subject: Re: [Wtr-general] Overriding UserAgent values in IE control

> 
> Paul,
> 
> Yes I've seen that, however I'd like to change it on the fly as 
> part of the tests, without having too rely on the test machine(s) 
> having this preconfigured.
> 
> 
> Regards,
> 
> Stephen
> 
> 
> 
> 
> > Date: Wed, 20 Dec 2006 09:11:18 -0700
> > From: [EMAIL PROTECTED]
> > To: wtr-general@rubyforge.org
> > Subject: Re: [Wtr-general] Overriding UserAgent values in IE control
> > 
> > it can be done via the registry
> > 
> > http://www.winguides.com/registry/display.php/799/
> > 
> > 
> > 
> > - Original Message -
> > From: Stephen Welch <[EMAIL PROTECTED]>
> > Date: Wednesday, December 20, 2006 3:19 am
> > Subject: [Wtr-general] Overriding UserAgent values in IE control
> > 
> > > 
> > > Is there any way to override, or append values to the user-
> agent 
> > > setting over the watir ie com object?
> > > 
> > > 
> > > Regards,
> > > 
> > > Stephen
> > > 
> > > 
> > > _
> > > Be one of the first to try Windows Live Mail.
> > > http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-
> > > 4314-9b0e-4911fb2b2e6d
> > > ___
> > > Wtr-general mailing list
> > > Wtr-general@rubyforge.org
> > > http://rubyforge.org/mailman/listinfo/wtr-general
> > > 
> > ___
> > Wtr-general mailing list
> > Wtr-general@rubyforge.org
> > http://rubyforge.org/mailman/listinfo/wtr-general
> 
> _
> Be one of the first to try Windows Live Mail.
> http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-
> 4314-9b0e-4911fb2b2e6d
> ___
> Wtr-general mailing list
> Wtr-general@rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
> 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Overriding UserAgent values in IE control

2006-12-20 Thread Stephen Welch

Paul,

Yes I've seen that, however I'd like to change it on the fly as part of the 
tests, without having too rely on the test machine(s) having this preconfigured.


Regards,

Stephen




> Date: Wed, 20 Dec 2006 09:11:18 -0700
> From: [EMAIL PROTECTED]
> To: wtr-general@rubyforge.org
> Subject: Re: [Wtr-general] Overriding UserAgent values in IE control
> 
> it can be done via the registry
> 
> http://www.winguides.com/registry/display.php/799/
> 
> 
> 
> - Original Message -
> From: Stephen Welch <[EMAIL PROTECTED]>
> Date: Wednesday, December 20, 2006 3:19 am
> Subject: [Wtr-general] Overriding UserAgent values in IE control
> 
> > 
> > Is there any way to override, or append values to the user-agent 
> > setting over the watir ie com object?
> > 
> > 
> > Regards,
> > 
> > Stephen
> > 
> > 
> > _
> > Be one of the first to try Windows Live Mail.
> > http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-
> > 4314-9b0e-4911fb2b2e6d
> > ___
> > Wtr-general mailing list
> > Wtr-general@rubyforge.org
> > http://rubyforge.org/mailman/listinfo/wtr-general
> > 
> ___
> Wtr-general mailing list
> Wtr-general@rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general

_
Be one of the first to try Windows Live Mail.
http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Executing javascript in 1.5

2006-12-20 Thread Charley Baker

Ah, you're adding it to the IE class, which in Watir 1.4.1 was a super of
Frame. In 1.5.1, Frame doesn't inherit from IE, but does include Container
and PageContainer as mixins. You'll want to change your run_script method to
the Container namespace:

module Watir::Container

 def run_script
  
 end

end

-Charley

On 12/20/06, Max Russell <[EMAIL PROTECTED]> wrote:


 I'm running the code on the same machine as I'm developing it…



The error I'm seeing is like this:





test_drag_and_drop(TestWatir):

NoMethodError: undefined method `run_script' for #

dragdrophacking.rbw:40:in `test_drag_and_drop'





The code I'm trying to work is one I've posted before on this list, based
on the zbarzone.blogspot.com/ example.

I don't expect it to complete the drag, but previously it would actually
select the div.



class Watir::IE

  def run_script(js)

ie.Document.parentWindow.execScript(js)

  end

end



class TestWatir < Test::Unit::TestCase

  def test_drag_and_drop

ie = 
Watir::IE.start('http://everestcf/CV_Tay_Test/home/Index.cfm'
)

#ie.maximize

ie.frame("main").text_field(:name, "username").set("ltanner")

ie.frame("main").text_field(:name,
"password").set("password9")

ie.frame("main").select_list(:name,
"ldapDir").select("SARAGON")

ie.frame("main").button(:name, "Login").click



#expand the admin node

ie.frame("left").link(:index, 35).click

#click on the data management link

ie.frame("left").link(:index, 54).click



#Enter a search string into the search field.

ie.frame("main").text_field(:id,
"Search_box").set("Batchelor")

#Click to search

ie.frame("main").button(:id, "btn_search").click



#insert a sleep

#sleep(5)



#Guessing at the path to the searched item...

ie.frame("main").div(:id, "10439,10439").flash #accessing
through the div id. Pretty Brittle for now, but can wrap this



widget = ie.frame("main").div(:id, "10439,10439")

#sleep(10)

#ie.frame("main").run_script("alert(document.getElementById
('10439,10439').id)")

#~ #THIS SECTION USES THE SCRIPTACULOUS DRAG/DROP

ie.frame("main").run_script("document.blah =
document.createEventObject(); document.blah.button = 1")


ie.frame("main").run_script("document.getElementById('#{widget}').fireEvent('onmousedown',
document.blah)")

ie.frame("main").run_script("document.blah =
document.createEventObject(); document.blah.clientX =
document.getElementById('search_results'); document.blah.clientY =
document.getElementById('drop_p1_toolbar')")#.offsetLeft .offsetTop
search_results


ie.frame("main").run_script("document.getElementById('#{widget}').fireEvent('onmousemove',
document.blah)")


ie.frame("main").run_script("document.getElementById('#{widget}').fireEvent('onmouseup',
document.blah)")

#~ sleep(20)

  end

end





I know the dragdrop hacking stuff is slightly outwith the scope of Watir,
but for me it's about the one thing that could really improve testing with
Watir.





*Max Russell*

*Test Analyst.*

*INPS*

* *

*Tel: 01382 223900*

*Fax: 01382 204488*

* *

*Visit our Web site at www.inps.co.uk*

* *

*The information in this internet email is confidential and is intended
solely for the addressee. Access, copying or re-use of information in it by
anyone else is not authorised. Any views or opinions presented are solely
those of the author and do not necessarily represent those of In Practice
Systems Limited or any of its affiliates. If you are not the intended
recipient please contact [EMAIL PROTECTED]



___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Executing javascript in 1.5

2006-12-20 Thread Max Russell
I'm running the code on the same machine as I'm developing it...

 

The error I'm seeing is like this:

 

 

test_drag_and_drop(TestWatir):

NoMethodError: undefined method `run_script' for
#

dragdrophacking.rbw:40:in `test_drag_and_drop'

 

 

The code I'm trying to work is one I've posted before on this list,
based on the zbarzone.blogspot.com/ example.

I don't expect it to complete the drag, but previously it would actually
select the div.

 

class Watir::IE

  def run_script(js)

ie.Document.parentWindow.execScript(js)

  end

end

 

class TestWatir < Test::Unit::TestCase

  def test_drag_and_drop

ie = Watir::IE.start('http://everestcf/CV_Tay_Test/home/Index.cfm')

#ie.maximize 

ie.frame("main").text_field(:name,
"username").set("ltanner")

ie.frame("main").text_field(:name,
"password").set("password9")

ie.frame("main").select_list(:name,
"ldapDir").select("SARAGON")

ie.frame("main").button(:name, "Login").click



#expand the admin node

ie.frame("left").link(:index, 35).click

#click on the data management link

ie.frame("left").link(:index, 54).click



#Enter a search string into the search field.

ie.frame("main").text_field(:id,
"Search_box").set("Batchelor")

#Click to search

ie.frame("main").button(:id, "btn_search").click



#insert a sleep

#sleep(5)



#Guessing at the path to the searched item...

ie.frame("main").div(:id, "10439,10439").flash #accessing
through the div id. Pretty Brittle for now, but can wrap this



widget = ie.frame("main").div(:id, "10439,10439")

#sleep(10)

 
#ie.frame("main").run_script("alert(document.getElementById('10439,10439
').id)")

#~ #THIS SECTION USES THE SCRIPTACULOUS DRAG/DROP

ie.frame("main").run_script("document.blah =
document.createEventObject(); document.blah.button = 1")

 
ie.frame("main").run_script("document.getElementById('#{widget}').fireEv
ent('onmousedown', document.blah)")

ie.frame("main").run_script("document.blah =
document.createEventObject(); document.blah.clientX =
document.getElementById('search_results'); document.blah.clientY =
document.getElementById('drop_p1_toolbar')")#.offsetLeft .offsetTop
search_results

 
ie.frame("main").run_script("document.getElementById('#{widget}').fireEv
ent('onmousemove', document.blah)")

 
ie.frame("main").run_script("document.getElementById('#{widget}').fireEv
ent('onmouseup', document.blah)")

#~ sleep(20)

  end

end

 

 

I know the dragdrop hacking stuff is slightly outwith the scope of
Watir, but for me it's about the one thing that could really improve
testing with Watir.

 

 

Max Russell

Test Analyst.

INPS

 

Tel: 01382 223900

Fax: 01382 204488

 

Visit our Web site at www.inps.co.uk

 

The information in this internet email is confidential and is intended
solely for the addressee. Access, copying or re-use of information in it
by anyone else is not authorised. Any views or opinions presented are
solely those of the author and do not necessarily represent those of In
Practice Systems Limited or any of its affiliates. If you are not the
intended recipient please contact [EMAIL PROTECTED]

 

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Executing javascript in 1.5

2006-12-20 Thread Charley Baker

You're calling straight into the document ole object, Watir shouldn't be
doing anything but passing the call on to IE. What error are you getting?
Are you running the scripts on the same box with different version of Watir
and seeing it fail?

-Charley

On 12/20/06, Max Russell <[EMAIL PROTECTED]> wrote:


 Has the support for executing javascript changed in 1.5?



A method I used previously:



  def run_script(js)

ie.Document.parentWindow.execScript(js)

  end



calling the execScript method no longer seems to work….



*Max Russell*

*Test Analyst.*

*INPS*

* *

*Tel: 01382 223900*

*Fax: 01382 204488*

* *

*Visit our Web site at www.inps.co.uk*

* *

*The information in this internet email is confidential and is intended
solely for the addressee. Access, copying or re-use of information in it by
anyone else is not authorised. Any views or opinions presented are solely
those of the author and do not necessarily represent those of In Practice
Systems Limited or any of its affiliates. If you are not the intended
recipient please contact [EMAIL PROTECTED]



___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Overriding UserAgent values in IE control

2006-12-20 Thread Paul Rogers
it can be done via the registry

http://www.winguides.com/registry/display.php/799/



- Original Message -
From: Stephen Welch <[EMAIL PROTECTED]>
Date: Wednesday, December 20, 2006 3:19 am
Subject: [Wtr-general] Overriding UserAgent values in IE control

> 
> Is there any way to override, or append values to the user-agent 
> setting over the watir ie com object?
> 
> 
> Regards,
> 
> Stephen
> 
> 
> _
> Be one of the first to try Windows Live Mail.
> http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-
> 4314-9b0e-4911fb2b2e6d
> ___
> Wtr-general mailing list
> Wtr-general@rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
> 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] CRITICAL---Clicking Image Button in Application

2006-12-20 Thread Rafael Torres
Try replacing 'button' with 'image' on the first line. 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Balaji
Sent: Wednesday, December 20, 2006 8:15 AM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] CRITICAL---Clicking Image Button in Application



Hi all,

I am trying to click on this image button with the following codes but
none worked:
This image button saves all the data entered in the current form and
navigate to the next page.

1. ie.button(:src,/btn_save_continue/).click
2. ie.button(:src,/agent/btn_save_continue/).click

Please someone help me. Its really urgent.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5866&messageID=16406#16406
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] CRITICAL---Clicking Image Button in Application

2006-12-20 Thread John Lolis
have you tried .fire_event('onClick')?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5868&messageID=16411#16411
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] CRITICAL---Clicking Image Button in Application

2006-12-20 Thread Željko Filipin

Hi Balaji,

Try this

ie.image(:src,/btn_save_continue/).click
--
Zeljko Filipin
zeljkofilipin.com
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] CRITICAL---Clicking Image Button in Application

2006-12-20 Thread Balaji
""IMG SRC='/images/agent/btn_save_continue.gif' BORDER=0 STYLE='cursor: 
pointer' onClick='change_has_been_handled = true; if (!this.clicked) 
{document.the_form.submit();; this.clicked = true;}'""

Hi all,

I am trying to click on this image button with the following codes but none 
worked:
This image button saves all the data entered in the current form and navigate 
to the next page.

1. ie.button(:src,/btn_save_continue/).click
2. ie.button(:src,/agent/btn_save_continue/).click

Please someone help me. Its really urgent.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5868&messageID=16408#16408
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] CRITICAL---Clicking Image Button in Application

2006-12-20 Thread Balaji


Hi all,

I am trying to click on this image button with the following codes but none 
worked:
This image button saves all the data entered in the current form and navigate 
to the next page.

1. ie.button(:src,/btn_save_continue/).click
2. ie.button(:src,/agent/btn_save_continue/).click

Please someone help me. Its really urgent.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5867&messageID=16407#16407
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] CRITICAL---Clicking Image Button in Application

2006-12-20 Thread Balaji


Hi all,

I am trying to click on this image button with the following codes but none 
worked:
This image button saves all the data entered in the current form and navigate 
to the next page.

1. ie.button(:src,/btn_save_continue/).click
2. ie.button(:src,/agent/btn_save_continue/).click

Please someone help me. Its really urgent.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5866&messageID=16406#16406
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] how to access an element whose html tag is

2006-12-20 Thread Željko Filipin

Vijay,

I have already replied to your question in another thread. This does not
work for you?

This will tell you that "Step 1. Details" is link, not in table cell.

irb(main):025:0> ie.link(:text, "Step 1. Details").exists?
=> true
irb(main):026:0> ie.cell(:text, "Step 1. Details").exists?
=> false

This will tell you that "Step 2. Inventors" is in table cell, not link.

irb(main):023:0> ie.link(:text, "Step 2. Inventors").exists?
=> false
irb(main):024:0> ie.cell(:text, "Step 2. Inventors").exists?
=> true
--
Zeljko Filipin
zeljkofilipin.com
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] how to install watir-1[1].5.1.1127.gem

2006-12-20 Thread Željko Filipin

On 12/20/06, liucongying <[EMAIL PROTECTED]> wrote:


I am a new watirer,I want to know how to install watir-1[1].5.1.1127.gem
 I have already install ruby185-21 and watir-1[1].5.0.945.exe, I want
to handle js-popup problem,please help me,thanks



You will find 1.5.1.1127 gem and installation help here

http://wiki.openqa.org/display/WTR/Development+Builds

Just make sure that after you download gem, it is named watir-1.5.1.1127.gem,
not watir-1[1].5.1.1127.gem (remove "[1]" from file name if necessary).
--
Zeljko Filipin
zeljkofilipin.com
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Syntax for relative attributes

2006-12-20 Thread Željko Filipin

On 12/20/06, Bret Pettichord <[EMAIL PROTECTED]> wrote:


  link = $ie.link(:class => 'addtocart', :is_after? => headline)



This would make sense to me (no question mark)

link = $ie.link(:class => 'addtocart', :after => headline)

"By convention, methods that answer questions (i.e. Array#empty? returns *
true* if the receiver is empty) end in question marks." (
http://www.ruby-lang.org/en/documentation/ruby-from-other-languages/)

This is not a method, but this convention really makes sense to me, so I
expect anything that ends with question mark to return true or false. Why
did you use question mark?
--
Zeljko Filipin
zeljkofilipin.com
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Wait functionality in Watir ..need help

2006-12-20 Thread John Lolis
You have the right idea, wanting to wait until the bar is done, but you are 
approaching it slightly wrong. I would first try to understand why *you* know 
the progress bar is done. Is it because the bar gets to the end and its full? 
Is it because something says 'complete'? How do you know it failed?

Once you gathered these answers you will probably find you are waiting for a 
certain event to occur. This event doesn't always happen X seconds after you 
click something, it happens when its done (it also will probably fail at some 
point).

So to start, we need to find that 'anchor' in the future. This is some page 
element that lets the user know that its done. Lets pretend this is an image. 
So we want to wait at most, lets say, 20 seconds (this depends on your app) or 
until some image exists.

I'm going to give you some code I'm just thinking up, this should be used to 
help illustrate my idea and maybe inspire a solution from you. I'm sure you 
will think up something much better on your own.

# Note the below code should not be used, its just an idea of how you might do 
this

wait_max = 20
wait_increment = .1
wait = 0

while wait < wait_max
.if ie.image(*whatever*).exists? #this is the event, it could be anything
..# Found it, do the next part
.else
..wait += wait_increment
end
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5861&messageID=16400#16400
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Wait functionality in Watir ..need help

2006-12-20 Thread Željko Filipin

while true
 break unless ie.text.include?("loading")
 sleep 1
end

You can replace

ie.text.include?("loading")

with anything that is appropriate, like

ie.checkbox(:id, "1").exists?
--
Zeljko Filipin
zeljkofilipin.com
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Simulate CNTRL-LEFT CLICK

2006-12-20 Thread Željko Filipin

On 12/20/06, Dave Munns <[EMAIL PROTECTED]> wrote:


The control left click on a specific object will invoke a frame with a
list of data. No url's involved...



Look at your html source (or send it to us).

You probably should do something like

fire_event("ControlLeftClick")
--
Zeljko Filipin
http://zeljkofilipin.com/
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] how to access an element whose html tag is

2006-12-20 Thread vijay
Thanks for your suggestion.  All the 7 elements in the page are recognized as 
"links" when they are in "enabled" states and in that situation, I am able to 
click all of them using 'ie.link' commands similar to the one given below:

ie.frame("Detail").link(:text,"Step 2. Inventors").click

But, when the web page first loads, only one (it is displayed as "Step 1. 
Details") out of the existant 7 elements is enabled and so only this element is 
recognized as a link by Watir.  The status of this element can be checked by 
the following command:

object_enabled = ie.frame("Detail").link(:text,"Step 1. Details").enabled?

The above command returns "True" to say that the element, "Step 1. Details", is 
enabled.  

But I am not sure how to check the statuses of other elements as Watir does not 
recognize them as links because they are disabled.  If a similar statement is 
used to check the element, "Step 2. Inventors" (which is in a disabled state), 
Watir says that it is "unable to find out the object using text and Step 2. 
Inventors".  The reason behind this, I believe, is that the element, "Step 2. 
Inventors" is not identifed as a link as it is in a disabled state (it is not 
categorized as a link because it cannot be clicked).  

So I am unable to find out the statuses of other elements because I am not sure 
what word to put instead of the word "link" in the following checking 
statement,   

object_enabled = ie.frame("Detail").link(:text,"Step 2. Inventors").enabled?

If I use the word, "element" instead of the word "link" in the above statement, 
Watir says "Undefined method 'element' for Watir Frame"


The 'html' of all the disabled items are present as:

 Active Element: [TD], Frame: [Detail], Index: [41] 
 Step 2. Inventors

Thanks, in Advance,
Vijay.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5711&messageID=16393#16393
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Executing javascript in 1.5

2006-12-20 Thread Max Russell
Has the support for executing javascript changed in 1.5?

 

A method I used previously:

 

  def run_script(js)

ie.Document.parentWindow.execScript(js)

  end

 

calling the execScript method no longer seems to work

 

Max Russell

Test Analyst.

INPS

 

Tel: 01382 223900

Fax: 01382 204488

 

Visit our Web site at www.inps.co.uk

 

The information in this internet email is confidential and is intended
solely for the addressee. Access, copying or re-use of information in it
by anyone else is not authorised. Any views or opinions presented are
solely those of the author and do not necessarily represent those of In
Practice Systems Limited or any of its affiliates. If you are not the
intended recipient please contact [EMAIL PROTECTED]

 

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] Wait functionality in Watir ..need help

2006-12-20 Thread Parvathy
I am trying to automate a web based application. IN the last step of the 
navigation through the website, when i click a button, it refreshes the page 
and displays a progress bar, and when the progress bar is finished, it again 
refreshes and gives the last page. If a write a Watir code without wait, it 
simply stops after clicking the button, without waiting fro the last page to 
come. I want the code include wait statement that waits for some attribute in 
the last page, so that the script goes to the last page before saying that 
script is complete.

Please help on this. I tried putting sleep statement. That works. But sometimes 
it requries more time for the page to laod nad it fails. can anyone suggest 
better way.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5860&messageID=16386#16386
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Wait functionality in Watir ..need help

2006-12-20 Thread Parvathy
I am trying to automate a web based application. IN the last step of the 
navigation through the website, when i click a button, it refreshes the page 
and displays a progress bar, and when the progress bar is finished, it again 
refreshes and gives the last page. If a write a Watir code without wait, it 
simply stops after clicking the button, without waiting fro the last page to 
come. I want the code include wait statement that waits for some attribute in 
the last page, so that the script goes to the last page before saying that 
script is complete.

Please help on this. I tried putting sleep statement. That works. But sometimes 
it requries more time for the page to laod nad it fails. can anyone suggest 
better way.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5861&messageID=16387#16387
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Overriding UserAgent values in IE control

2006-12-20 Thread Stephen Welch

Is there any way to override, or append values to the user-agent setting over 
the watir ie com object?


Regards,

Stephen


_
Be one of the first to try Windows Live Mail.
http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Syntax for relative attributes

2006-12-20 Thread Christian Kreutzer
i can't see much difference between :after? and :is_after?. i would
read both versions as link after headline

Christian

On 12/20/06, Bret Pettichord <[EMAIL PROTECTED]> wrote:
> Yi, Lawrence wrote:
> > I would see that as link after headline.
> >
> >
> That was my original intention.
>
> Is this clearer?
>
>   link = $ie.link(:class => 'addtocart', :is_after? => headline)
>
>
> Bret
>
> ___
> Wtr-general mailing list
> Wtr-general@rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general