Lorraine,

Actually, I wrote a page object library that can do this sort of thing. 
Assuming that you have defined a page object for the Client page, and you 
are on the page for a particular client, you could just do something like 
this to get the client guid:

site.page.arguments[:client]

Library's here and it's packaged as a gem (gem install site-object):

https://github.com/jfitisoff/site-object

I didn't mention it before because you said you're new to this and were 
looking for a simple answer. Feel free to ping me if you decide to try it 
and need any help.


On Wednesday, June 17, 2015 at 7:20:04 AM UTC-7, johnssn wrote:
>
> Use a regular expression. Assuming that the URL is *"*
> http://www.mysite.com/client/abcde012345*"*:
>
> browser.url.match(%r{/client/(.*)})[1]
> => *"*abcde012345*"*
>
>
>   ------------------------------
>  *From:* Lorraine Botros <lorrain...@gmail.com <javascript:>>
> *To:* watir-...@googlegroups.com <javascript:> 
> *Sent:* Tuesday, June 16, 2015 4:24 PM
> *Subject:* [wtr-general] Code suggestions on how to get a guid from an 
> href to be used to append to other hrefs.
>  
> The site I am automating creates a unique guid when a new client is 
> created so I will see something like 
> http://www.mysite.com/client/abcde012345 where 'abcde012345 is the unique 
> identifier for that client. I want to get that value and use it to append 
> to another link such as http://www.mysite.com/client/profile/abcde012345 
>
> I am a newbie to coding so any help or suggestions on good sites to find 
> examples is greatly appreciated.
>  -- 
> -- 
> Before posting, please read http://watir.com/support. In short: search 
> before you ask, be nice.
>  
> watir-...@googlegroups.com <javascript:>
> http://groups.google.com/group/watir-general
> watir-genera...@googlegroups.com <javascript:>
>
> --- 
> 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 watir-genera...@googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>  

-- 
-- 
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

--- 
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 watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to