How to use regex for a variable in repository ?

Ask general questions here.
rastek
Posts: 157
Joined: Wed Aug 06, 2014 12:00 pm

How to use regex for a variable in repository ?

Post by rastek » Mon Aug 11, 2014 2:19 pm

Hi,

I want to parametrise the IP part of the url in my repository.

URL is like that

http://27.168.150.63:8560/web/images/dial_pad.png

But I only want to parametrise IP, not whole url. Normaly I am familirize with regex, but I am confused. How can I achieve this in ranorex ?

Ps: I already read "Combining Variables with Parameters" part of the Lesson 3: Data-Driven Testing but could not find the answer there.
Thanks.
Last edited by rastek on Mon Aug 11, 2014 6:55 pm, edited 1 time in total.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: How to use regex for a variable in repository ?

Post by krstcs » Mon Aug 11, 2014 2:55 pm

/dom[@url='http://' + $IPAddress + ':' + $Port + '/web/images/dial_pad.png']
Shortcuts usually aren't...

rastek
Posts: 157
Joined: Wed Aug 06, 2014 12:00 pm

Re: How to use regex for a variable in repository ?

Post by rastek » Mon Aug 11, 2014 6:54 pm

Thanks krstcs
that helped me.

rastek
Posts: 157
Joined: Wed Aug 06, 2014 12:00 pm

Re: How to use regex for a variable in repository ?

Post by rastek » Tue Aug 12, 2014 12:44 pm

hi Krstsc

I still got a problem for this variables.

you know its a base path variable (domain for a Browser).Normaly, for an item in repository, I click right on the corresponding line in the actions panel and select "make Item variable". But for the base path this option is not available bcos there is no spesific action.

So I directly harcoded the variable inside path as you say, and it is working when I call it from test case, but gives error when I call module level (using mo: option). So I have put it in a tests case and binded variable, but still not working, only works if I call the test case.

There is not a binding option at recording module level ? How can I achieve this ?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: How to use regex for a variable in repository ?

Post by krstcs » Tue Aug 12, 2014 1:43 pm

Any time you drop a repo object in the action table and the repo object has a variable in its path, the system will assume you are using that variable in the action table as well. All you will need to do is bind the variable as normal.


Also, I may be misunderstanding what you are wanting. If this information is what you are using to launch a website (i.e., you are typing this into the URL bar) then you don't need to make it a part of the path, you just need to launch the browser with this URL.

Please let me know specifically what you are trying to accomplish, with detailed steps.
Shortcuts usually aren't...