Spot on, thanks. I don't really know Ruby yet but using your advice I got it working.
My new code; require 'watir' test_site="http://www.blah.com/uk/home.asp?src=ash" ie = Watir::IE.new ie.speed = :fast ie.goto test_site url=ie.url url_splitted=url.split("?") if url_splitted[0] == "http://www.blah.com/uk/home.asp" puts "ok" else puts "bugger!" end On May 1, 1:01 pm, karim rayani <[email protected]> wrote: > do one thing if you know ruby somewhat > > url=ie.url > > url_splitted=url.split("?") > > puts url_splitted[0] should give you the base url > > > > > > On Fri, May 1, 2009 at 5:00 PM, ash <[email protected]> wrote: > > > Having searched this group, plus the wiki, plus the mail archives I am > > still a little confused as to the syntax format for stripping text > > from a url. Apologies if there is a thread covering this already but > > I am now getting frustrated with this as it seems such a simple task > > but I can't get my head round it. > > > I have a check in a test to ensure that the url reached is correct but > > there is a variable at the end of the url that I don't need. How do I > > get rid of this? > > > My url is of the formathttp://www.blah.com/uk/home.asp?variable > > > So far I have discovered that the following will possibly help; > > new_url = ie.url[/(.*)\//] although this strips everything after > > "uk/". I just need to strip out "?variable". > > > My question is really; What does this mean? [/(.*)\//] > > > Cheers...Ash > > -- > Regards, > > Alkarim Rayani- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
