Forum Discussion

Azeddin_Margani's avatar
Azeddin_Margani
Contributor
8 years ago
Solved

Insert variables in a dynamic URL

Hi,

 

Could someone help, please - I'm trying to code URL that has got dynamic variables?.

 

The mapping name is:

Aliases.browser.Page("https://www.busstage.com/regionaltickets/west-area/London/megarider").Panel(0).Panel(3).Panel(0).Panel(0).Panel(3).Panel(0).Panel(1).Panel(2).Panel(0).Panel(0).Panel(0)

 

Knowing that, west-area and  London are dynamic. 

 

I've tried the following code but is not working:

var Var1 = DDT.CurrentDriver.Value("Location"); //location is passed from spreadsheet.

 

Aliases.browser.Page("https://www.busstage.com/regionaltickets/?*/@Var1/megarider").Panel(0).Panel(3).Panel(0).Panel(0).Panel(3).Panel(0).Panel(1).Panel(2).Panel(0).Panel(0).Panel(0)

 

Regards,

A.M.

 

 

 

  • Your variables are inside double quote. So they'll be treated as part of the string.

     

    Try:

     

    "https://www.busstage.com/regionaltickets/*/" + Var1 + "/megarider"

     

    (Not sure what language you're using. May need to use & instead of + to concat the string parts)

3 Replies