Katalon Studio Drop-down List Select

Hi everyone, I’m writing with Katalon Studio. In this article, I would like to mention briefly about the solution I found for the problem that the items in the dropdown list cannot be captured by using Catalyst or Web Spy in Katalon Studio. Due to the different code techniques used in web projects, test tools such as Katalon Studio fail to capture some items. The most common problem with these items is in drop-down lists. In some cases, the selected value cannot be detected by Record Web i of Katalon Studio and the test is failing at this stage. For these fields, you can have Katalon Studio run successfully in these steps of the test with a few minor changes after the saving stage.

First of all, I want to explain the above example, https://select2.github.io/select2-bootstrap-theme/4.0.3.html drop-down in the list of items trying to select an item to save the test drop. Let’s select an item in the -down list and perform the save operation, then examine the test steps

As can be seen from the test steps below, after the registration step on the Katalon Studio, only the one marked on the image above is displayed. step was detected, 2 steps in this list even though the item is selected from the list was not caught at this stage.


In this case, you can follow these steps:

Click on the 1-Drop-Drown list.

2-Right click on the item to select. // right click to detect the item.

3-After this step, the path information is updated from the item’s Select Editor options.

Now, take these steps again for the test case where we received the error and examine the result.

When you run the test steps again on the page, when you right-click on the relevant item in the selection phase, the selected item is captured as you will see in step 4 of the katalon Studio project.

After first saving is completed, item 4 will be displayed as rightClick, you can update it as click.


After that, the Object Repository folder contains the corresponding test item and the Select Editor page opens.

On this page, the XPath information for the corresponding item is updated by replacing it with the more marked XPath information.


If you run the test again after this step, the related item in the list will be selected without error.

I hope it has been a useful post.

Emine Aktürk - https://emineakturkblog.wordpress.com/

6 Likes

Can I suggest you change the category for this post to ‘Katalon Studio - Tips and Tricks
The Katalon Recorder category refers to to the browser plugin/addon :slightly_smiling_face:

hello @Mark_Gibson
Thak you …

1 Like

Can you help me related with ‘Drop-down List’ select.
I don’t know how to do.Please help me.

Hello @htooeaindralin199851

  1. Copy the value corresponding to the Relative field in the screenshot.
  2. The current expression in the Selected Locarator field is deleted.
  3. The copied expression is pasted here.
    That is all.

Please, can you help me? I don’t precisely know how to copy value corresponding to the Relative field in the screenshot.If you are OK, can you show me screenshot.Thank you very much indeed.

Hello @htooeaindralin199851 please watch the video.
Katalon Studio - 7.2.1-2a7abb4c - Example 1 - Web Testing - [Location_ C__Users_sedat_Katalon Studio_Example 1 - Web Testing] 2020-02-25 09-41-39.mp4.zip (2.6 MB)

1 Like

Thank you so much.It is OK.

1 Like

Hi, i tried to use the xpath for capturing the dropdown item but when in script it always selects the first values from the dropdown, is there any way to select the dropdown depending on the Text and global variables

image

i found a solution by using Variables in xpath that can be set in the script

//ul[@id=‘WellId_listbox’]/li[text()=’${WellName}’]

WebUI.click(findTestObject(‘V3/Wells/Well Tasks/Add- Edit Task/li_Well List box’, [(‘WellName’) : GlobalVariable.WellName]))

1 Like

Hello @emine How can i select the value in the dropwdown where the elements are href ?Below is the image of elements-

below is the image which option i want to select from the dropdown-

I want to select the second option “Impersonate user” but katalon giving below error-
Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Impersonate Objects/DropdownImpersonate/Dropdwon_Impersonate User’ located by ‘By.xpath: //*[@href = ‘javascript:void(0)’ and @id = ‘glide_ui_impersonator’ and (text() = ‘Impersonate User’ or . = ‘Impersonate User’)]’ not found
at

It is really helpful post.

1 Like

@ishta.kulshresthna
First of all, you should point to “Impersonate user” and right click during test case saving.

Then, as I mentioned in the above article, you should select the Relative extension from the properties for the “Impersonate user”. Please review the spelling for this stage.