[Wtr-general] Need to fetch the ID
Željko Filipin
zeljko.filipin at gmail.com
Mon Jun 11 08:21:57 EDT 2007
On 6/11/07, sapna <forum-watir-users at openqa.org> wrote:
>
> <a
> href="/AppsUIWeb/SelfService/MessageDetail.aspx?id=1303&messageToUser=True">RE:
> Check Copy Request</a>
Sapna,
To find id of that link you have to know some other attribute of that link.
I will assume that you know text "RE: Check Copy Request"
This is how you can get href attribute of that link.
irb> ie.link(:text, "RE: Check Copy Request").href
=>
"file:///C:/AppsUIWeb/SelfService/MessageDetail.aspx?id=1303&messageToUser=True"
This will extract 1303.
irb> m = /id=(1303)/.match(ie.link(:text, "RE: Check Copy Request").href)
=> #<MatchData:0x2d147b8>
irb> m[1]
=> "1303"
For more information see class MatchData (
http://phrogz.net/ProgrammingRuby/ref_c_matchdata.html)
Zeljko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070611/7f498e88/attachment.html
More information about the Wtr-general
mailing list