I wish unique ID or Name attribute could be added but it's not
possible.
So, I am still using index way.
So far it's working fine, but I am still looking for a better
solution.
Thanks for responses
:)
On Mar 6, 2:30 am, SuperKevy wrote:
> The thread about adding a unique ID or Name attribute to
The thread about adding a unique ID or Name attribute to the link is a
good one and provides a solid hook.
Its the easiest and a "perferred"
If thats not possible... you can get all the links (by index) then
fingerprint the URL content of each for something you can reliably
lock onto.
For example
I think you have a few potential solutions
1) talk to your developers about making this thing more testable, e.g.
assign something like an ID or Name value to that link in the HTML, it
won't be visable on the page, but it would make it easier to select
the right link. I don't know your app, but
Thanks for rresponses
I used
ie.link(index,2).text
to fetch the values
value.split to use them in next step.
But another issue,
Index of link always changes, and there is no other attribute to
identify this link.
How can I make sure I am clicking on correct link every time?
On Mar 5, 2:53 am, S
Thanks
On Mar 4, 6:40 pm, bwaybandit wrote:
> you need to use ruby string functions to get to this.
>
> in this case for example you could (assuming your url is in a variable
> called foo), use foo.slice(foo.length-3,3). this would return 4,5. you
> can split this off a comma delimiter and get
You want the URL I'm assuming.. then parse that for the info at the
end
---Sample of Google. Whats the URL to the Privacy link --
require 'watir'
include Watir
ie. = IE.new
ie.goto('http://www.google.com')
puts ie.link(:text,'Privacy').attribute_value('href')
--~--~-~--~~--
you need to use ruby string functions to get to this.
in this case for example you could (assuming your url is in a variable
called foo), use foo.slice(foo.length-3,3). this would return 4,5. you
can split this off a comma delimiter and get back ["4"] and ["5"]. -
test.split','
this will not wo