Katalon Studio Drop-down List Select

@emine Hello,
thanks for your reply. As you can see in the image below the Selected locator is the same as the Xpath relative. In you case it was not and solved the problem.

@giorgos.ks hi ,
Now I understand better the cause of the error.
If there is more than one field with the same xpath information in Catalon studio, the last saved one will be considered valid. This will cause the click area you originally registered with the same name to not be found.
I suggest you a solution: Save your test until step 10, then save the rest, but keep their object repostory folders separate.
image
image

hi @emine
i just show the image that i have sent.
I do not have the same name twice.
See the correct photo.



@giorgos.ks hi ,
While saving the test, click on the Dropdown box normally,
Right click on your option value, Test Log.
**Then edit the code, it shouldn’t be right click in your code.**They must all be clicks.

@emine Hello,

please have a look at the video that i have upload.
https://we.tl/t-YahlzneQHk

And what happens when you create an Object with the tag of span, and a xpath of id("select2-status-container") and then put the Object into a click statement?

WebUI.click(findTestObject('mypage/myNewObject'))

Edit: I started thinking based on the id attribute that you may need to add more attributes to uniquely identify your “Inactive”, so how about:
//span[@id="select2-status-container" and @title="Inactive"]

or
Perhaps you can try what the Web Spy gives you.

I don’t notice anything specifically wrong. An issue I have is your pathway in the image where you have an <ul> tag (//ul[@id='select2-status-results']/li) does not seem to be around the HTML you are showing. So, that is disconcerting.

What happens if you comment out the Active and just have the Inactive? Again, just for a test.

Edit: can you stop your test when on the Active so you can check if the “Inactive” pathway we are using actually does exist? In which case, then you can add:

WebUI.waitForElementVisible(findTestObject('mypage/li_Inactive'), 10)
WebUI.click(findTestObject('mypage/li_Inactive'))

Edit2: when you stop the test on the Active, can you see if <select> tag still has the “hidden” part of the class attribute? Maybe you have to “click” on the textbox and then select the item in the drop-down…how do you do it manually?

I notice you are using setText, but are not checking to ensure the text is set. How about?

WebUI.setText(findTestObject('myPage/Page_Bal...'), "textGoesHere")
WebUI.verifyElementAttributeValue(findTestObject('myPage/Page_Bal...'), "value", "textGoesHere", 10)

Your image shows you have “span_Active2” and “span_Inactive2” with the same pathway. Obviously, that is not going to work.

Based on the below OP, maybe you can do your click on Active and then do a selectOptionByLabel(findTestObject('myPage/select_Status'), "Active") and then do the same thing with Inactive–click on Inactive and then selectOptionByLabel(findTestObject('myPage/select_Status'), "Inactive")

Element should have been “select” but was “span” - Product Forums / Katalon Studio - Katalon Community