On Wednesday, March 20, 2013 4:33:55 AM UTC-7, mc060200778 wrote:

> Hi,
>
> i am facing problem in automating the following HTML code
>
> <a href="#divCustomerLinesTab" data-toggle="tab">Customer Lines<span 
> class="tabLoading" id="divCustomerLinesTabTab" style="display: 
> inline;"></span></a>
>
> I am using the following lines but NOTHING IS working for me :( please 
> help & advise
>
> @browser.span(:class,"tabLoading").click
> *@browser.link(:href,"http://TestApp:8080/CustomerManagement/";).click*
> *@browser.a(:text,"CustomerLines").click*
> *
> *
>

Firstly, actual 'results' for each of those --especially if it's an error 
message, but even if it's 'nothing got clicked and the script kept 
running'-- are really really helpful to the people you are asking to assist 
you.

Secondly lets look at each of your items in turn.

@browser.span(:class,"tabLoading").click

Presuming for a moment this did not give an error, and that there is but 
one single span in the entire page with this class, then you might try 
clicking the parent. Given that the span had an ID that did not appear to 
be randomly generated, I'd suggest using that instead, since they are 
supposed to be unique on the page, to identify the element you want

@browser.span(:id => "divCustomerLinesTabTab").click 
or maybe try clicking it's parent, a link, something more commonly clicked

@browser.span(:id => "divCustomerLinesTabTab").parent.click 

Next you tried

@browser.link(:href,"http://TestApp:8080/CustomerManagement/<http://testapp:8080/CustomerManagement/>
").click
*
*
I don't generally use the entire URL when selecting by href because it will 
change if your test env changes. Either go for a partial match using a 
portion of the url as a regex, or use something else like the link text 
(presuming you don't expect that to change often) However in this case, the 
href given is nothing like the value you supplied, so I would expect it to 
generate an error that it could not locate the object. If you want to 
select that by href, then your code should have looked more like this

@browser.link(:href => "#divCustomerLinesTab").click 

Next you had this, trying to click the anchor tag (link) by the text
*
*
@browser.a(:text,"CustomerLines").click
*
*
This is another thing I'd expect to generate a not found error, since the 
link text you give above, does not match the HTML you gave. Presuming the 
HTML is right, you should be using something like this (I use 'link' 
instead of the tag name 'a' since a lot of folks think of anchor tags as 
'links' and for me anyway I feel it's more readable code. 

@browser.link(:text => "Customer Lines").click

A good way to test this stuff out is to use IRB, and try out the commands 
against the browser that way. Using the .flash method first (as Super Kevy 
showed hin his answer) is a good way to see if you are really locating the 
thing you think you are. 

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

[email protected]
http://groups.google.com/group/watir-general
[email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to