Handling Different paths in a page

I’m currently doing a POC using Katalon studio. In my web page there is specified fields included in the testing web page for specific countries.
For an example there is a Mandatory field in Address field called Street 1. bt for another specific country there is another mandatory field called Street 2. Another specific country same web Page have Street 3. Likewise think that there is more than 5 specific codes in the same web page in different different countries. how to script and handling the code in katalon?
(P.s. : Differentiation is not included in the same web page for all the countries. We have to Set the specific Country using the DB (backend))

1 Like

Hi there,

Thank you very much for your topic. Please note that it may take a little while before a member of our community or from Katalon team responds to you.


It seems that your Application Under Test provides a single URL (a web page) that could possibly have 5 different patterns of page view (HTML code) according to which locale a user resides.

Then let me ask you a question, @hsenidautomation.

How does your web system gets the information which country a user lives when he/she makes a query?

I ask this question because your Katalon Test Cases have to pretend to be one of the 5 users of different locales.

How the test script can pretend to be a user of a specific locale? — Don’t ask it to others in the user forum. You should specify it. Nobody, other than you, can answer to this question because the answer depends on the design of your Application Under Test.

KS allows to have “conditional” programming so, depending on the country, you can run specific “street” methods (either Keywords, or called test cases) to handle each case separately. So maybe you can do:

if (WebUI.verifyOptionSelectedByLabel(findTestObject('myPage/input_BckGrd_StreetOne'), "Canada", false, 10) {
} else if (WebUI.verifyOptionSelectedByLabel(findTestObject('myPage/input_BckGrd_StreetOne'), "Spain", false, 10) {
} ...

If you have lots of Street views, then perhaps you can do a “switch / case” condition. But I think there are ways you can do it.

Note: if as @kazurayam states and you have to “become” different people, then your developers may have to add a page in your Dev/Stage/Test area that you move to and “voila”, you take on a new Role or something.

Note2: if you don’t have the Enterprise version, then you could just put your “street” method/code in-line of the “if” statements.

Maybe like:
if (WebUI.verifyOptionSelectedByLabel(findTestObject('myPage/input_BckGrd_StreetOne'), "Canada", false, 10) {
    blah blah1
    blah blah blah1
} else if (WebUI.verifyOptionSelectedByLabel(findTestObject('myPage/input_BckGrd_StreetOne'), "Spain", false, 10) {
    blah blah2
    blah blah blah2
} ...

There are two approaches to handle this requirement:

  1. Add steps for all the required fields and make them optional, although this might slow down your execution.
  2. Utilize condition handling (Switch/If-Else) to execute only the necessary steps.
1 Like

How will i Handle if various of languages were involved in my web Page for some some countries?

Sorry, but you will have to explain how the different languages interfere with your coding.

If the “people” that come to your site are allowed to change languages on your web page, then again, talk to your developers to assist you or, if there is a switch, like French and English, or perhaps a drop-down, then incorporate the switch, or drop-down, and language choice in your test like the user would.