Try URI::HTTP class.
if you have url "http://hostname/path/to/file?key=valu&key2=value42"
then
require 'uri'
uri = URI.parse ie.url
gives you an uri object that conforms to HTTP protocol, so....
url.query.split('&') # => array of queryitems =['key=value', 'key2=value42']
you can then reconstruct the uri object with whatever you want and pass it
back to watir as
so if you have session = "jsessionid=AbraCadA43BraSalthUnd42Pepper" you can
add it to existing query
url.query = (queryitems.concat session).join('&')
and click it.
uri.to_s # becuse you click text and not object
you end up with this url
"
http://hostname/path/to/file?key=valu&key2=value42&jsessionid=AbraCadA43BraSalthUnd42Pepper
"
Do more homework here
http://www.ruby-doc.org/core/classes/URI/HTTP.html
marekj
Watirloo: Semantic Page Objects in UseCases
http://github.com/marekj/watirloo/
On Tue, Mar 31, 2009 at 12:03 AM, vasu <[email protected]> wrote:
>
> Dear All,
>
> Iam using datadriven framework, and used href to click on a link. It
> was working fine. Now for security reason unique session ID was also
> generated and same was updated to the href for each login session.
>
> Please let me know how to capture the sessionID from URL and update
> the same in XLS.
>
> My script is like this:
>
>
> ie.link(:href, record4['url']).click
> ie.textField(:name, "targetnumber").set(record4['targetnumber'])
>
> Previous url was like this: https://abcd.com/test.in?cmd=p2p
>
> now it is like this :
> https://abcd.com/test.in;jsessionid=JRvbP1CyCY5tMd153lZJ9mzp5Rv7tNWQ4n232VL1GZFT1sppsTQ5!878380993<https://abcd.com/test.in;jsessionid=JRvbP1CyCY5tMd153lZJ9mzp5Rv7tNWQ4n232VL1GZFT1sppsTQ5%21878380993>
>
> I want to capture the jsessionid generated.
>
> Please help me it is very urgent
>
> thanks,
> vasu
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines:
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---