Forum Discussion

JustinL22's avatar
JustinL22
Contributor
2 years ago
Solved

Using a variable in a URL

Hi,

 

I am wanting to use a variable that I have created in a key word test and add it to a URL so I can launch it via a python script and was wondering how to do that.

 

I have used set variable value in the keyword test to get an ID from the screen e.g. 12345. I then want to write a python script to launch a browser with a specified url and that variable value on the end e.g. Browsers.Item["chrome"}.Run("https://testurl.co.uk/testid= Then have the variable id added to the end. How can I grab the variable value and add it to the end of the url in the script?

 

Thanks

  • The script coding will look something like,

     

    Browsers.Item["chrome"].Run("https://testurl.co.uk/testid=" + MyVariable)

     

     

     

     

     

3 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    The script coding will look something like,

     

    Browsers.Item["chrome"].Run("https://testurl.co.uk/testid=" + MyVariable)

     

     

     

     

     

    • Marsha_R's avatar
      Marsha_R
      Champion Level 3

      In rraghvani 's example, be sure you have any extra characters or spaces stripped out of MyVariable before you do this or the URL will be bad.  If MyVariable is already clean, then no worries.

       

       

      Browsers.Item["chrome"].Run("https://testurl.co.uk/testid="+aqString.Trim(MyVariable,aqString.stAll))