Re: [Wtr-general] Click a button

2007-07-06 Thread Angrez Singh

Try

ie.button(:class, btn_login_up).click

- Angrez

On 7/6/07, Chitta Ranjan [EMAIL PROTECTED] wrote:


 Hi,,


I want to click a button using any one of these attribute

class -  btn_login_up
onmousedown-
this.className='btn_login_dn'
onmouseup-
this.className='btn_login_up'
type   - submit


I tried

   ie.button(:type, 'submit').click
ie.button(:name, LOGIN).click(no name attribute is
available)


But not succeed to click the button


Any suggestion

Thanks in advance
Chitta Ranjan






___
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] Click on button which isn't a button

2007-03-16 Thread Željko Filipin

This worked for me (watir 1.5.1.1158).

ie.div(:text, Register now).click
--
ZeljkoFilipin.com
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Click on button which isn't a button

2007-03-16 Thread John
This works, thanks!
But I have a complication: our site has multiple languages and we want to be 
able to run the tests on all languages.
Therefore I can't use the text property, because this will be different in 
another languag than English.
Of course I can use ie.form(:name, retailLocation).submit instead, but this 
way I bypass the button and won't notice it when the button itself is not 
working.
I would like to click on the div element based on index, but this doesn't seem 
to work?
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Click on button which isn't a button

2007-03-16 Thread Adam Reed
Yep - I just got a new mockup for one of our upcoming sites that uses divs in 
the same way, and I used the div-click just like Zeljko shows when the index 
method doesn't seem to find them.
 
However, if you're experimenting and driving around the website for a while 
using IRB, sometimes IRB seems to quit for me.  I could specify divs that I 
knew existed and had previously clicked on, and they would not activate or give 
me an error - they'd just hang out instead.  I exited IRB and started it right 
back up again, and they worked flawlessly.  I'm not sure how common this is, 
but you might want to try it out.
 
Thanks,
Adam



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Željko Filipin
Sent: Friday, March 16, 2007 5:49 AM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Click on button which isn't a button


This worked for me (watir 1.5.1.1158).

ie.div(:text, Register now).click
-- 
ZeljkoFilipin.com 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Click on button which isn't a button

2007-03-16 Thread Željko Filipin

If language changes I would recommend that you ask your developer to add an
id attribute to div tag. Then you would not have to rely on text. If that is
not the option, you can try this.

ie.cell(:html, /registration/).click

or

ie.cell(:html, /registration/).div(:text, //).click
--
ZeljkoFilipin.com
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Click on button which isn't a button

2007-03-16 Thread Adam Reed
This brings up an interesting issue that came up yesterday.  We have a new 
front-end designer on staff who was creating some mockups for a new project.  I 
was getting familiar with his code and using watir to navigate around, and 
noticed that of the ~90 divs on the page, only 5-6 have unique (or any) id 
tags.  These unnamed divs make up the primary navigation system for the site.  
There are no images, buttons or tables on the page.
 
So of course, not thinking much into it - I ask if it would be possible for him 
add unique id tags to the major navigational elements (50% of the divs are not 
important to anything other than design).  He replied, saying that adding 
unique ids to all elements would wreak havoc with style sheets, since all of 
these unnamed divs share the same style information.  Also, for Search Engine 
Optimization (SEO), he needs to keep as much unnecessary text off the page as 
possible (although this point is debatable).
 
In this case, where do we go from here?  I completely understand his point, but 
at the same time I would be prevented from automating the majority of the tests 
on the new site.  Of course we don't rely 100% on automation (probably less 
than 50%), but 100% manual testing requires quite more time, and produces many 
fewer test results.
 
I'd be interested to hear solutions, or just comments on the issue - I know it 
has to be fairly common.
 
-- Adam



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Željko Filipin
Sent: Friday, March 16, 2007 8:38 AM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Click on button which isn't a button


If language changes I would recommend that you ask your developer to add an id 
attribute to div tag. Then you would not have to rely on text. If that is not 
the option, you can try this.

ie.cell(:html, /registration/).click 

or

ie.cell(:html, /registration/).div(:text, //).click
-- 
ZeljkoFilipin.com 
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Click on button which isn't a button

2007-03-16 Thread Paul Carvalho

Hi Adam, this is the situation we have with our navigation bar for one of
our web apps.  Using Watir 1.4.1 I couldn't use the 'text' attribute for
SPAN tags and none of the Spans had unique ID's.  What I ended up doing was
creating two methods to help us navigate the system.

The first one is called 'populate_navigation_bar' and the second is
navigate_bar().  In the first method, I iterate through all the Div and
Span tags with the desired information and put them into a Hash array.  The
'values' are the index numbers.

Then when I want to navigate through the system, I call the navigate_bar()
method and pass it the name I want and the method clicks the corresponding
element using the index number.  This gives me a certain amount of
flexibility in my tests because I can now select random elements really
easily for each test run, navigate to the 'top' of the list regardless of
whatever it's called, and other cool things like that.

In Watir 1.5.x, I can now use the 'text' attribute for Spans, but I decided
to keep navigating the system the same way because I have greater control
this way.

That's how I deal with the problem anyway.  Maybe this might work for you?
Good luck!

Cheers.  Paul C.


On 16/03/07, Adam Reed wrote:


 This brings up an interesting issue that came up yesterday.  We have a
new front-end designer on staff who was creating some mockups for a new
project.  I was getting familiar with his code and using watir to navigate
around, and noticed that of the ~90 divs on the page, only 5-6 have unique
(or any) id tags.  These unnamed divs make up the primary navigation system
for the site.  There are no images, buttons or tables on the page.

So of course, not thinking much into it - I ask if it would be possible
for him add unique id tags to the major navigational elements (50% of the
divs are not important to anything other than design).  He replied, saying
that adding unique ids to all elements would wreak havoc with style sheets,
since all of these unnamed divs share the same style information.  Also, for
Search Engine Optimization (SEO), he needs to keep as much unnecessary text
off the page as possible (although this point is debatable).

In this case, where do we go from here?  I completely understand his
point, but at the same time I would be prevented from automating the
majority of the tests on the new site.  Of course we don't rely 100% on
automation (probably less than 50%), but 100% manual testing requires quite
more time, and produces many fewer test results.

I'd be interested to hear solutions, or just comments on the issue - I
know it has to be fairly common.

-- Adam

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

Re: [Wtr-general] Click on button which isn't a button

2007-03-16 Thread Adam Reed
Thanks for the help Paul.  I did have one question about this method,
however:
 
As far as putting indexes and the name you want in the Hash array, does
this assume that the indexes of certain elements are constant through
the website?  The reason that I didn't use index navigation inititally
was because as each div is clicked and activated, the div indexes around
the page appear to change.  While at first the Home div is #7, after
being clicked it becomes #9.  Would this throw a wrench in the gears of
your script?
 
There's a very good chance I've just missed the point, but that's how I
understand it so far.
 
Thanks again,
Adam



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Carvalho
Sent: Friday, March 16, 2007 3:23 PM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] Click on button which isn't a button


Hi Adam, this is the situation we have with our navigation bar for one
of our web apps.  Using Watir 1.4.1 I couldn't use the 'text' attribute
for SPAN tags and none of the Spans had unique ID's.  What I ended up
doing was creating two methods to help us navigate the system. 

The first one is called 'populate_navigation_bar' and the second is
navigate_bar().  In the first method, I iterate through all the Div
and Span tags with the desired information and put them into a Hash
array.  The 'values' are the index numbers. 

Then when I want to navigate through the system, I call the
navigate_bar() method and pass it the name I want and the method clicks
the corresponding element using the index number.  This gives me a
certain amount of flexibility in my tests because I can now select
random elements really easily for each test run, navigate to the 'top'
of the list regardless of whatever it's called, and other cool things
like that. 

In Watir 1.5.x, I can now use the 'text' attribute for Spans, but I
decided to keep navigating the system the same way because I have
greater control this way.

That's how I deal with the problem anyway.  Maybe this might work for
you?  Good luck! 

Cheers.  Paul C.



On 16/03/07, Adam Reed wrote: 

This brings up an interesting issue that came up yesterday.  We
have a new front-end designer on staff who was creating some mockups for
a new project.  I was getting familiar with his code and using watir to
navigate around, and noticed that of the ~90 divs on the page, only 5-6
have unique (or any) id tags.  These unnamed divs make up the primary
navigation system for the site.  There are no images, buttons or tables
on the page.
 
So of course, not thinking much into it - I ask if it would be
possible for him add unique id tags to the major navigational elements
(50% of the divs are not important to anything other than design).  He
replied, saying that adding unique ids to all elements would wreak havoc
with style sheets, since all of these unnamed divs share the same style
information.  Also, for Search Engine Optimization (SEO), he needs to
keep as much unnecessary text off the page as possible (although this
point is debatable).
 
In this case, where do we go from here?  I completely understand
his point, but at the same time I would be prevented from automating the
majority of the tests on the new site.  Of course we don't rely 100% on
automation (probably less than 50%), but 100% manual testing requires
quite more time, and produces many fewer test results.
 
I'd be interested to hear solutions, or just comments on the
issue - I know it has to be fairly common.
 
-- Adam


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

Re: [Wtr-general] Click on button which isn't a button

2007-03-16 Thread Paul Rogers

there is a trick you can use when using stylesheets and id tags ( i forget 
exactly what/why) , but there are definitely other ways and probably better 
ways to do it.
How much time will it take for him to change the divs to use 
class='some_css_clss' and ad ids, compared to you finding a way round this? My 
guess is its going to be better for everyone if he does it correctly.
Can he put names on instead?
How about a custom attribute ( div id=css_hack tester_thing=id1 ) and then 
you do a quick hack in wastir to use testter_thing as an attribute ( thats 
actually pretty easy I think )

Some on the thread mentioned multi-lingual problems so they couldnt use :text - 
heres how I fixed that.  I already had hundreds of elements coded, so couldnt 
afford the time to go back and change them all 

$lang = :french
ie.div(:text , 'Click Me') .click

We overrode the various watir methods- to check the $lang if its not set it 
uses english, otherwise it uses the specified language. Then looks up in an 
array ( or xml, or yaml, or whatever) and finds the english ( in this case 
CLick Me )
It then looks for the equivalent in the supplied language.. 
This way your script is still readable in English.
Im sure its not the best way, but as we had lots of code already it seemed like 
the best way


  - Original Message - 
  From: Adam Reed 
  To: wtr-general@rubyforge.org 
  Sent: Friday, March 16, 2007 8:32 AM
  Subject: Re: [Wtr-general] Click on button which isn't a button


  This brings up an interesting issue that came up yesterday.  We have a new 
front-end designer on staff who was creating some mockups for a new project.  I 
was getting familiar with his code and using watir to navigate around, and 
noticed that of the ~90 divs on the page, only 5-6 have unique (or any) id 
tags.  These unnamed divs make up the primary navigation system for the site.  
There are no images, buttons or tables on the page.

  So of course, not thinking much into it - I ask if it would be possible for 
him add unique id tags to the major navigational elements (50% of the divs are 
not important to anything other than design).  He replied, saying that adding 
unique ids to all elements would wreak havoc with style sheets, since all of 
these unnamed divs share the same style information.  Also, for Search Engine 
Optimization (SEO), he needs to keep as much unnecessary text off the page as 
possible (although this point is debatable).

  In this case, where do we go from here?  I completely understand his point, 
but at the same time I would be prevented from automating the majority of the 
tests on the new site.  Of course we don't rely 100% on automation (probably 
less than 50%), but 100% manual testing requires quite more time, and produces 
many fewer test results.

  I'd be interested to hear solutions, or just comments on the issue - I know 
it has to be fairly common.

  -- Adam



--
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Željko Filipin
  Sent: Friday, March 16, 2007 8:38 AM
  To: wtr-general@rubyforge.org
  Subject: Re: [Wtr-general] Click on button which isn't a button


  If language changes I would recommend that you ask your developer to add an 
id attribute to div tag. Then you would not have to rely on text. If that is 
not the option, you can try this.

  ie.cell(:html, /registration/).click 

  or

  ie.cell(:html, /registration/).div(:text, //).click
  -- 
  ZeljkoFilipin.com 


--


  ___
  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] Click on button which isn't a button

2007-03-16 Thread Paul Carvalho

Heh.  You didn't miss the point.  That's why populate_navigation_bar is a
method! ;-)

Cheers!  Paul C.


On 16/03/07, Adam Reed [EMAIL PROTECTED] wrote:


 Thanks for the help Paul.  I did have one question about this method,
however:

As far as putting indexes and the name you want in the Hash array, does
this assume that the indexes of certain elements are constant through the
website?  The reason that I didn't use index navigation inititally was
because as each div is clicked and activated, the div indexes around the
page appear to change.  While at first the Home div is #7, after being
clicked it becomes #9.  Would this throw a wrench in the gears of your
script?

There's a very good chance I've just missed the point, but that's how I
understand it so far.

Thanks again,
Adam

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

Re: [Wtr-general] click the button in form

2006-09-12 Thread boominathan
hi,
  first u write correct frame name and button name. First u find which frame 
contains that button. then u write script like this
$ie.frame(framename).button(:name or :value,the proper name or the Proper 
value).flash then click.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=4101messageID=11315#11315
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] click the button in form

2006-09-12 Thread Zeljko Filipin
Hi Ban,I will tell you how I solved your problem.I made a html file that contained the smallest amount of html code that I thought would be enough to reproduce your problem. Here it is:
input type=submit value=:: Login
gt;Then, i opened irb and tried to reproduce your error.C:\Documents and Settings\zfilipin\Desktopirbirb(main):001:0 require 'watir'= trueirb(main):002:0 ie = Watir::
IE.attach(:title, //)= #Watir::IE:0x2e54690 [...removed some text...]irb(main):003:0 ie.button(:value, :: Login gt;).clickWatir::Exception::UnknownObjectException: Unable to locate object, using value and :: Login gt;
[...the rest of error message...]Then, I did some investigation.irb(main):004:0 ie.button(:index, 1).value= :: Login So, for watir value of that button is 
:: Login  and not :: Login
gt; as it is in html file. That is because gt; represents  character in html files (to avoid confusion, because all tags end with ).
Then I tried to flash that button.irb(main):006:0* ie.button(:value, :: Login ).flash= nil(It flashed).Then I tried to click it.irb(main):007:0 
ie.button(:value, :: Login ).click= Success! :)Zeljko
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] click the button in form

2006-09-12 Thread Zeljko Filipin
Hi Boominathan,Please, do not take this as a personal attack to you, but it would be better if you did not reply if you did not want to help. Ban posted a perfect request for help. He posted a description of his problem, html code, watir code and error message. And it was short enough. He did not post nothing irrelevant to the problem. He kept it short and posted all I needed to reproduce his problem and solve it.
I remember how I was surprised when I saw that watir sees gt; as  and it was not hard for me to solve it because I am familiar with html. Ban (maybe) is not, so a minute of my time probably saved him a lot of time. So, he can do his job, earn some money and buy me a beer if we meet sometime. But, we will probably never meet, so he can buy that beer to his developer. But enough about beer.
What I wanted to say is - I like watir because it is great tool, and I like the people that use it. They seem friendly. I would like to have a beer with any watir user I meet. But, I started about beer again.
What I wanted to say is (second iteration) - I get sad when I see a post that is not friendly (not rude or something, just not friendly).This post got pretty long. Once more - please, do not take this personally. I did not mean to insult you. Just, if you think somebody posted a stupid question, please do not answer in a non friendly tone. In my opinion, it is better not to answer.
ZeljkoOn 9/12/06, boominathan [EMAIL PROTECTED] wrote:
hi,first u write correct frame name and button name. First u find which frame contains that button. then u write script like this$ie.frame(framename).button(:name or :value,the proper name or the Proper value).flash then click.

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

Re: [Wtr-general] click the button in form

2006-09-12 Thread Ban Hoang








Hi Zeljko,



Thanks for your great help, it work
perfectly!



Ban



Ps. I will buy you a beer if you have a chance to come to California











From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf Of Zeljko Filipin
Sent: Tuesday, September 12, 2006
5:10 AM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] click
the button in form





Hi Ban,

I will tell you how I solved your problem.

I made a html file that contained the smallest amount of html code that I
thought would be enough to reproduce your problem. Here it is:

input type=submit value=:: Login gt;

Then, i opened irb and tried to reproduce your error.

C:\Documents and Settings\zfilipin\Desktopirb
irb(main):001:0 require 'watir'
= true
irb(main):002:0 ie = Watir:: IE.attach(:title, //)
= #Watir::IE:0x2e54690 [...removed some text...]
irb(main):003:0 ie.button(:value, :: Login gt;).click
Watir::Exception::UnknownObjectException: Unable to locate object, using value
and :: Login gt; 
[...the rest of error message...]

Then, I did some investigation.

irb(main):004:0 ie.button(:index, 1).value
= :: Login 

So, for watir value of that button is :: Login  and not
:: Login gt; as it is in html file. That is because
gt; represents  character in html files (to
avoid confusion, because all tags end with ). 

Then I tried to flash that button.

irb(main):006:0* ie.button(:value, :: Login ).flash
= nil

(It flashed).

Then I tried to click it.

irb(main):007:0 ie.button(:value, :: Login ).click
= 

Success! :)

Zeljko 






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

RE: [Wtr-general] Click OK button on Popup Dialog?

2005-07-25 Thread Cain, Mark








Hue,
you have to start the WinClicker BEFORE you click the button that produces the
popup.



I have a function (right out of the unittests)



#Popup clicker

def startClicker( button , waitTime = 3)

 w = WinClicker.new

 longName = $ie.dir.gsub(/ , \\ )

 shortName = w.getShortFileName(longName)

 c = start rubyw #{shortName }\\watir\\clickJSDialog.rb
#{button } #{ waitTime} 

 puts Starting #{c}

 w.winsystem(c)

 w=nil

end



#Then I call it...

startClicker (OK, 3)



#Then I click the button that produces the popup.

ie.frame(rightframe).frame(search).button(:name,
Submit).click



Hope this helps,



--Mark

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Hue Mach Dieu
Sent: Monday, July 25, 2005 4:16 AM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] Click OK button on Popup Dialog?



Hi All,

My script for click on OK button on popup warning message dialog box,

but it doesn't work



ie.frame(rightframe).frame(search).button(:name,
Submit).click



w = WinClicker.new



w.clickWindowsButton(Microsoft Internet
Explorer,OK)

w.clickJavaScriptDialog(OK)



Thank for help







___

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