[wtr-general] Re: logic to compare the two sheets in watir

2011-08-29 Thread jp


No,i am using open office org calc..


On Aug 27, 6:36 pm, Hugh McGowan colinsda...@gmail.com wrote:
 Are you talking about Excel? If so, you can use 'roo' to parse the
 pages and you can pretty easily compare the contents of the Excel
 worksheets

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] wait for new click event..

2011-08-29 Thread byung
I wish to record URL of each page I visit using Watir.

I have come up with the below coding.

require 'watir'

ie = Watir::IE.start(http://www.testsite.com;)

file = File.open(c:/test_URL.txt, a)


0.upto(1000) { |f|


file.puts ie.url()

sleep 5

}

file.close


with code above, I need to click new web link every 5 seconds
exactly.  I REALLY CANNOT MAKE SURE I VISIT / CLICK TO PAGE EVERY 5
SECONDS.

Would it be possible to ignite

file.puts ie.url()

when I just click a link on the current page while above watir  code
is on the page??

I look through google search, but i couldn't find anything that could
help me.

I WISH WATIR CODE THAT WILL NOTICE NEW CLICK BY THE USER.. and then
ignite file.puts ie.url()  when click event occurs.

thanks.

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Hi

2011-08-29 Thread Hari
I am having trouble clicking a link as Watir seems to have trouble
finding it:

This is what I have tried:

ie.link(:text,'Find a Request').click

Error:

./watir.rb:1939:in `assert_exists': Unable to locate object, using
text and Find
 a Request (Watir::Exception::UnknownObjectException)
from ./watir.rb:2020:in `click'
from C:/watir-v1_4/Service.rb:49

Here is the source code of the page.

A onblur=webFXTreeHandler.blur(this); id=cwc_menu_local:ROOT.Find
a Request-anchor

onfocus=webFXTreeHandler.focus(this);
ondblclick=webFXTreeHandler.selectOpen(this);

onclick=var stat=webFXTreeHandler.select(this); if(!stat)return
stat;; href=http://gits.csscorp.com/smweb/cwc/nav.menu?
name=navStartid=ROOT%2FFind%20a%20Request

target=detailSPAN class=cwc_navMenuLabelFind a Request/SPAN/
A


How to click a  link ' Find a Request ' - anchor with SPAN

Do I need to firewatir some sort of event before trying to click on
the Run
This link?

I hope all that is clear and that someone can help me.

Thanks


-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Having trouble finding a link

2011-08-29 Thread Alister Scott
please play around and try something else like:

ie.link(:id = 'cwc_menu_local:ROOT.Find a Request-anchor').exists?
ie.link(:id = 'cwc_menu_local:ROOT.Find a Request-anchor').text

etc.

Also, please use a proper subject for future discussions. eg. NOT hi

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Unable to click anchor with image inside LI tag

2011-08-29 Thread Alister Scott
is it visible?
can you do something like ie.link(:class, x-tab-strip-close).fire_event 
onclick

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: logic to compare the two sheets in watir

2011-08-29 Thread Alister Scott
Roo wil also work with openoffice. 
Please see: http://roo.rubyforge.org/

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: wait for new click event..

2011-08-29 Thread Alister Scott
It is very unclear what you are trying to do.

If you're trying to visit every url in a file, you should use the ie.goto 
method, not ie.url method.


-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Re : Re: Re : Re: Re : Re: Re : Watir is slow with nested frames

2011-08-29 Thread Alister Scott
+1 to working with the developers to get rid of 7 nested frames. That is 
ridiculous.

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: wait for new click event..

2011-08-29 Thread byung
The web site I start with WATIR has special security measure, and link
URL does not show in html.

all I can do to visit the link is to click the text on the page
manually.

now I would like to visit each link manually, and record its URL
using

file.puts ie.url()

so I wish watir code to recognize that I have clicked a new link, and
whenever I click new link, record its URL in the text file.

thanks.

On Aug 29, 5:19 am, Alister Scott alister.sc...@gmail.com wrote:
 It is very unclear what you are trying to do.

 If you're trying to visit every url in a file, you should use the ie.goto
 method, not ie.url method.

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Hi

2011-08-29 Thread Željko Filipin
On Mon, Aug 29, 2011 at 2:04 PM, Hari harisankarec...@gmail.com wrote:
 ie.link(:text,'Find a Request').click

Try this:

ie.span(text,'Find a Request').click

Željko
--
watir.com - community manager
watir.com/book - author
watirpodcast.com - host

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: How to bypass basic authentication ?

2011-08-29 Thread Alister Scott
What watir gem are you using? Watir-WebDriver?
I just tried Watir-WebDriver then with both firefox and chrome and both 
worked immediately without any problems.

uby-1.9.2-p290 :001  require watir-webdriver
 = true 
ruby-1.9.2-p290 :002  b = Watir::Browser.new
 = #Watir::Browser:0x..f9578bef11631505a url=about:blank title= 
ruby-1.9.2-p290 :003  b.goto http://admin:password@192.168.0.1/;
 = http://192.168.0.1/setup.cgi?next_file=start.htm; 
ruby-1.9.2-p290 :007  b = Watir::Browser.new :chrome
b.goto  = #Watir::Browser:0x3785bf4e43b91242 url=about:blank 
title=about:blank 
ruby-1.9.2-p290 :008  b.goto http://admin:password@192.168.0.1/;
 = http://admin:password@192.168.0.1/setup.cgi?next_file=start.htm; 

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: How to bypass basic authentication ?

2011-08-29 Thread Alister Scott
And documented: http://watirwebdriver.com/basic-browser-authentication/

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Re : Re: Re : Re: Re : Re: Re : Re: Re : Watir is slow with nested frames

2011-08-29 Thread JMI


 Le samedi 27 août 2011 14:55:20 UTC+2, Jarmo Pertman a écrit :

Okay, i have looked into this issue now. I've set a breakpoint just 
 before the #text_field invocation and didn't see as many invocations 
 as you did (didn't count them, but it was something in the lines of ~5 
 times). I don't understand where did you get that number 1536. 

 I got this number from the ruby profiler by adding requre 'profile' at the 
beginning of test_frame.rb. 
When I count the calls of assert_exists programmatically, by adding $x+=1 in 
the body of assert_exists and puts $x at the end of the program, I get 512 
(obviously the profiler counts three times too many).
But still this is much too many! You can also add puts #{@what} to the body 
of assert_exists to see exactly for which elements this method is called and 
recalled before the actual set is done.


 Anyway, i looked at the code and saw that everything that can be done 
 is already done. 

I am not so pessimistic. 
 

 All caches are dangerous if not implemented properly 

I agree
 

 and your patch breaks the point of assert_exists: 
 1) the element is located at the first place 
 2) the element is removed from the DOM, e.g. assert_exists should fail 
 3) your patch returns the previously located element, e.g. the 
 assert_exists doesn't fail 

 Also, this makes #exists? also return true although it should return 
 false. 

 Two responses:
1) For cases with no frames: Each time assert_exists is called for a 
given element by the method set (or any other method that interacts with 
this element), it is first called for each frame containig this element, so 
surely the cache will change and the element will be relocated.
2) For cases with no frames: Each time when you interact with a different 
element (ie., with different locators), the cache changes. So to reproduce 
your scenario I should do something like that:
- set my_text_field to a value
- wait till my_text_field is removed from the DOM (without Watir interacting 
with any other element, as interacting would change the cache)
- set again my_text_field to a value (or do something else to my_text_field)
I can hardly imagine a need for such a test scenario in real life.


 In conclusion, i'd still say that the application which uses 7 nested 
 () frames is really badly made and should be rewritten anyway. No 
 offence. 

No offence! I have already said it is not me who created the application!
 

 So, it is just one really bad corner-case where it's slower 
 than usual, but unfortunately i don't see any good solution at this 
 moment how to solve it for everyone. 

Just one really bad corner-case, and I am just in it! 
 

 I guess you can use #value for 
 that specific case, but i'm pretty sure you will also have slower 
 invocations with other methods. 

Yes, the problem concerns every interaction with elements placed within 
nested frames.


 Also, one solution would be to open that frame directly in your 
 browser instead of accessing it through all the other 6 frames. 
 Something like this with this concrete example or just create some 
 helper module, which could generate the correct url: 
 my_frame=ie.frame(:name, '7.6').frame(:name, '6.5').frame(:name, 
 '5.4').frame(:name, '4.3').frame(:name, '3.2').frame(:name, 
 '2.1').frame(:name, '1.0') 
 ie.goto ie.url.gsub(/\d+\.html$/, my_frame.src) 
 ie.text_field(:name, 'edit_box').set('123456789') 

This would mean cutting the application into pieces (a piece per frame). And 
these pieces will most probably not behave as the whole application...
 
Jurek

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: how do I select li link with id from a jquery dynamic list

2011-08-29 Thread Jarmo
I'm not sure that #click_no_wait is needed. Send me the actual html code
instead. Do it somehow like this:
ie.link(:id, launchIndustry).click_no_wait # this bottom is to launch the
form - attached
container = ie.div(:id, industry)
ie.wait_until {container.present?} # does this mean that the view on the
screenshot is visible now?
File.open(page.html, w) {|f| f.puts ie.html}

Now, send us the page.html :)

Jarmo

On Mon, Aug 29, 2011 at 7:18 PM, M mo10soc...@gmail.com wrote:

 Thanks Jarmo,

 I tried to use your solutions with no luck - i still can't locate the
 elements. Here is my code and the HTML code, I also attached a screen shot
 of the page so you know the type of pop up that I am dealing with. any help
 is appreciated

 ie.link(:id, launchIndustry).click_no_wait # this bottom is to launch the
 form - attached
 container = ie.div(:id, industry)
 ie.wait_until {container.present?}
 ie.li(:id = industry_Technology__Internet).when_present.click
 ie.li(:id = supersector_Technology__Internet).when_present.click
 ie.li(:id = sector_Software__Computer_Services).when_present.click
 ie.li(:id = subsector_Computer__IT_Services).when_present.click
 ie.button(:src, /btn_continueHover.png/).click
 puts 'XX DONE page1
 X1'
 ie.li(:id = busiArea_IT_/_Engineering).when_present.click
 ie.li(:id = funcArea_Information_Technology).when_present.click
 ie.li(:id = specFunction_Software_Engineering).when_present.click
 ie.button(:src, /btn_continueHover.png/).click
 puts 'XX DONE page2
 X1'


 HTML Code: Notice that the UL and IL are empty.

 div id=overlay class=hidden


   div id=industry class=modal hidden

   form action=# method=post class=active 
 id=industryModalForm


   div class=page1 clearfix
   h2 style=background: 
 url(/static/images/blue_gradient.png) repeat-x;font-size: 
 1.5em;margin-bottom: 0;padding-top: 9px;padding-bottom: 0px;a href=# 
 class=industryModalClose style=float: right;padding-right: 10px;a 
 href=# class=industryModalClose style=float: right;padding-right: 
 10px;img src=/static/images/icon_modal_close.png alt=close//aSelect 
 IndustryspanPage 1 of 2/span/h2


   p class=headingPlease specify the industry 
 and sector for strong class=company/strong by making a selection in 
 emall four boxes/em. A company's sector is determined by its source of 
 revenue or where it generates most of its revenue./p

   dl class=first id=primary_list 
 style=padding-left: 15px;

   dtPrimary Industry/dt
   dd
   ul
   /ul

   /dd
   /dl
   dl id=supersector_list

   dtSupersector/dt
   dd
   ul

   /ul
   /dd
   /dl
   dl id=sector_list

   dtSector/dt

   dd
   ul

   /ul
   /dd
   /dl
   dl id=subsector_list

   dtSubsector/dt
   dd

   ul

   /ul
   /dd
   /dl
   div class=buttons style=margin: 0px 0px 
 10px;padding-left: 20px;width: 100%;


   input type=image 
 src=/static/images/btn_continueDisabled.png alt=Continue height=39 
 width=113 disabled


   a href=# class=goback style=left: 
 170px;top: -8px;Cancel/a


   /div

   /div
   div class=page2 hidden clearfix

   h2 style=background: 
 url(/static/images/blue_gradient.png) repeat-x;font-size: 
 1.5em;margin-bottom: 0;padding-top: 9px;padding-bottom: 0px;a href=# 
 class=industryModalClose style=float: right;padding-right: 10px;img 
 src=/static/images/icon_modal_close.png alt=close//aSelect 
 FunctionspanPage 2 of 2/span/h2


   p class=headingPlease specify the function 
 of the strong class=title/strong position by making a selection in 
 emall three boxes/em./p


   dl class=first id=busiArea_list 
 style=padding-left: 

[wtr-general] Re: how do I select li link with id from a jquery dynamic list

2011-08-29 Thread Jarmo
The registration process was too tedious :(

By looking at you html then indeed, the ul is empty. As long as it's empty
then you can't find the li :) Are you sure that the li should be there?
Maybe it's a timing issue. Try something like this:
# do something to trigger the popup
wait_until {div(:id = industry).ul.lis.size  0}

What happens? Can you see that the list is filled and does it still timeout?
Anyway, i suspect it is a timing issue - just find out some nice way to say
to Watir that wait as long as this condition is met meaning that the list
is loaded properly. As long as the ul is empty and there should be li-s in
there, Watir can't find the li's. Also, remember that Watir does most of the
things a lot faster than you can do manually and having JavaScript in the
game means that there could be some race conditions.

Good luck!

Jarmo

On Mon, Aug 29, 2011 at 7:46 PM, M mo10soc...@gmail.com wrote:

 I am attaching the page.html.
 I replaced the click_no_wait with click. ie.wait_until {container.present?}
 means that I am waiting for the view of the screenshot to be visible.
 Also if you want to see a real example, you can go to:
 http://qa.jobsync.com/
 and sign up for a new account. During the registration process you'll have
 to go through that page. Experience section


 Thanks for the help


 On Mon, Aug 29, 2011 at 9:27 AM, Jarmo jarm...@gmail.com wrote:

 I'm not sure that #click_no_wait is needed. Send me the actual html code
 instead. Do it somehow like this:
 ie.link(:id, launchIndustry).click_no_wait # this bottom is to launch
 the form - attached
 container = ie.div(:id, industry)
 ie.wait_until {container.present?} # does this mean that the view on the
 screenshot is visible now?
 File.open(page.html, w) {|f| f.puts ie.html}

 Now, send us the page.html :)

 Jarmo


 On Mon, Aug 29, 2011 at 7:18 PM, M mo10soc...@gmail.com wrote:

 Thanks Jarmo,

 I tried to use your solutions with no luck - i still can't locate the
 elements. Here is my code and the HTML code, I also attached a screen shot
 of the page so you know the type of pop up that I am dealing with. any help
 is appreciated

 ie.link(:id, launchIndustry).click_no_wait # this bottom is to launch
 the form - attached
 container = ie.div(:id, industry)
 ie.wait_until {container.present?}
 ie.li(:id = industry_Technology__Internet).when_present.click
 ie.li(:id = supersector_Technology__Internet).when_present.click
 ie.li(:id = sector_Software__Computer_Services).when_present.click
 ie.li(:id = subsector_Computer__IT_Services).when_present.click
 ie.button(:src, /btn_continueHover.png/).click
 puts 'XX DONE page1
 X1'
 ie.li(:id = busiArea_IT_/_Engineering).when_present.click
 ie.li(:id = funcArea_Information_Technology).when_present.click
 ie.li(:id = specFunction_Software_Engineering).when_present.click
 ie.button(:src, /btn_continueHover.png/).click
 puts 'XX DONE page2
 X1'


 HTML Code: Notice that the UL and IL are empty.

 div id=overlay class=hidden





 div id=industry class=modal hidden

 form action=# method=post class=active 
 id=industryModalForm





 div class=page1 clearfix
 h2 style=background: 
 url(/static/images/blue_gradient.png) repeat-x;font-size: 
 1.5em;margin-bottom: 0;padding-top: 9px;padding-bottom: 0px;a href=# 
 class=industryModalClose style=float: right;padding-right: 10px;a 
 href=# class=industryModalClose style=float: right;padding-right: 
 10px;img src=/static/images/icon_modal_close.png 
 alt=close//aSelect IndustryspanPage 1 of 2/span/h2





 p class=headingPlease specify the industry 
 and sector for strong class=company/strong by making a selection in 
 emall four boxes/em. A company's sector is determined by its source of 
 revenue or where it generates most of its revenue./p




 dl class=first id=primary_list 
 style=padding-left: 15px;

 dtPrimary Industry/dt
 dd
 ul
 /ul

 /dd
 /dl
 dl id=supersector_list

 dtSupersector/dt
 dd
 ul

 /ul
 /dd
 /dl
 dl id=sector_list

 dtSector/dt

 dd
 ul

 /ul
 /dd
 /dl
 dl id=subsector_list


[wtr-general] Re: how do I select li link with id from a jquery dynamic list

2011-08-29 Thread Jarmo
I used jQuery to fill these radios at one point:
$(input[type=radio]).attr(checked, checked) :)

But the problem was in the end that you clicked on the li, but you had to
click on the link inside of the li. This code works for me:

require watir
b = Watir::Browser.attach :url, //
b.link(:id = launchIndustry).click
b.li(:id = industry_Basic_Materials).when_present.a.click

Jarmo

On Mon, Aug 29, 2011 at 8:51 PM, M mo10soc...@gmail.com wrote:

 Sorry for the long registration...  :) , I normally just tab and enter to
 fill the personality radios...sorry
 all the ul and li are dynamically generated by the server (jquery). so they
 will not be there until the user clicks on the first link, and then the next
 list will appear and the user will choose from it and so on. I'll try to add
 the timing issue and see what happens.

 I'll keep you posted.

 Thanks


 On Mon, Aug 29, 2011 at 10:42 AM, Jarmo jarm...@gmail.com wrote:

 The registration process was too tedious :(

 By looking at you html then indeed, the ul is empty. As long as it's empty
 then you can't find the li :) Are you sure that the li should be there?
 Maybe it's a timing issue. Try something like this:
 # do something to trigger the popup
 wait_until {div(:id = industry).ul.lis.size  0}

 What happens? Can you see that the list is filled and does it still
 timeout? Anyway, i suspect it is a timing issue - just find out some nice
 way to say to Watir that wait as long as this condition is met meaning that
 the list is loaded properly. As long as the ul is empty and there should be
 li-s in there, Watir can't find the li's. Also, remember that Watir does
 most of the things a lot faster than you can do manually and having
 JavaScript in the game means that there could be some race conditions.

 Good luck!

 Jarmo

 On Mon, Aug 29, 2011 at 7:46 PM, M mo10soc...@gmail.com wrote:

 I am attaching the page.html.
 I replaced the click_no_wait with click. ie.wait_until
 {container.present?} means that I am waiting for the view of the screenshot
 to be visible.
 Also if you want to see a real example, you can go to:
 http://qa.jobsync.com/
 and sign up for a new account. During the registration process you'll
 have to go through that page. Experience section


 Thanks for the help


 On Mon, Aug 29, 2011 at 9:27 AM, Jarmo jarm...@gmail.com wrote:

 I'm not sure that #click_no_wait is needed. Send me the actual html code
 instead. Do it somehow like this:
 ie.link(:id, launchIndustry).click_no_wait # this bottom is to launch
 the form - attached
 container = ie.div(:id, industry)
 ie.wait_until {container.present?} # does this mean that the view on the
 screenshot is visible now?
 File.open(page.html, w) {|f| f.puts ie.html}

 Now, send us the page.html :)

 Jarmo


 On Mon, Aug 29, 2011 at 7:18 PM, M mo10soc...@gmail.com wrote:

 Thanks Jarmo,

 I tried to use your solutions with no luck - i still can't locate the
 elements. Here is my code and the HTML code, I also attached a screen shot
 of the page so you know the type of pop up that I am dealing with. any 
 help
 is appreciated

 ie.link(:id, launchIndustry).click_no_wait # this bottom is to launch
 the form - attached
 container = ie.div(:id, industry)
 ie.wait_until {container.present?}
 ie.li(:id = industry_Technology__Internet).when_present.click
 ie.li(:id = supersector_Technology__Internet).when_present.click
 ie.li(:id = sector_Software__Computer_Services).when_present.click
 ie.li(:id = subsector_Computer__IT_Services).when_present.click
 ie.button(:src, /btn_continueHover.png/).click
 puts 'XX DONE page1
 X1'
 ie.li(:id = busiArea_IT_/_Engineering).when_present.click
 ie.li(:id = funcArea_Information_Technology).when_present.click
 ie.li(:id = specFunction_Software_Engineering).when_present.click
 ie.button(:src, /btn_continueHover.png/).click
 puts 'XX DONE page2
 X1'


 HTML Code: Notice that the UL and IL are empty.

 div id=overlay class=hidden








   div id=industry class=modal hidden

   form action=# method=post class=active 
 id=industryModalForm








   div class=page1 clearfix
   h2 style=background: 
 url(/static/images/blue_gradient.png) repeat-x;font-size: 
 1.5em;margin-bottom: 0;padding-top: 9px;padding-bottom: 0px;a href=# 
 class=industryModalClose style=float: right;padding-right: 10px;a 
 href=# class=industryModalClose style=float: right;padding-right: 
 10px;img src=/static/images/icon_modal_close.png 
 alt=close//aSelect IndustryspanPage 1 of 2/span/h2








   p class=headingPlease specify the industry 
 and sector for strong class=company/strong by making a selection in 
 emall four boxes/em. A company's sector is determined by its source 
 of revenue or where it generates most of its revenue./p







   dl class=first id=primary_list 
 style=padding-left: 15px;

[wtr-general] way to check whether new page has been loaded..

2011-08-29 Thread byung
is there a way to check whether a new page has been loaded in WATIR??

could anyone tell me a way to check new page load in WATIR??

thanks.

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com