rauny
11 years agoOccasional Contributor
How to run Keyword tests in different urls.
Hi guys,
I need some advice to adjust my Keyword Tests. I've already recorded my tests, and that worked fine. But, now I need to run the same tests in different Urls.
I've tried creating a variable in the project, and setting the value with that variable.
New Url: "http://localhost:7003/administracao/login/loginPage.xhtml"
After this, I run the test again, the web browser page is open in the new address, but the tests didn't work, because the actions, for example, set text login, saved the previous address for the action:
NameMapping.Sys.Browser().Page("http://localhost:8080/administracao/login/loginPage.xhtml").Panel(0).Panel(0).Panel("idLoginPanel").Panel(1).Panel("contentLogin").Form("form_login").Panel(0).Textbox("j_username")
I need to change one by one? I've tried changing to (Url) but that didn't work too.
NameMapping.Sys.Browser().Page(Url).Panel(0).Panel(0).Panel("idLoginPanel").Panel(1).Panel("contentLogin").Form("form_login").Panel(0).Textbox("j_username")
Can you guys help me?
Thanks.
I need some advice to adjust my Keyword Tests. I've already recorded my tests, and that worked fine. But, now I need to run the same tests in different Urls.
I've tried creating a variable in the project, and setting the value with that variable.
New Url: "http://localhost:7003/administracao/login/loginPage.xhtml"
After this, I run the test again, the web browser page is open in the new address, but the tests didn't work, because the actions, for example, set text login, saved the previous address for the action:
NameMapping.Sys.Browser().Page("http://localhost:8080/administracao/login/loginPage.xhtml").Panel(0).Panel(0).Panel("idLoginPanel").Panel(1).Panel("contentLogin").Form("form_login").Panel(0).Textbox("j_username")
I need to change one by one? I've tried changing to (Url) but that didn't work too.
NameMapping.Sys.Browser().Page(Url).Panel(0).Panel(0).Panel("idLoginPanel").Panel(1).Panel("contentLogin").Form("form_login").Panel(0).Textbox("j_username")
Can you guys help me?
Thanks.
- Without using namemapping, it's a bit trickier. You most likely will not be able to retain your recorded steps. You may need to re-construct your keyword test. Basically, you'd need to do something like
Use the Call Object Method test action to call the ToURL method on the Sys.Browser() object, passing in the URL variable to the method.
Add in your On Screen actions manually... when prompted for the page object (NameMapping.Sys.Browser().Page()) enter an asterisk (*) for the page URL. This will take whatever page you have up.
Honestly, it's a LOT easier if you at least map your page and then set the URL value on your page to be your project variable for the URL.
Now, based upon your original post, it LOOKS like all you are changing in the URL is the port number. In which case, step 1 above may be all that is necessary to open up your initial URL. Then you can double click on each action and just replace the port number in your action with the asterisk.
Hope this helps.