Drop down list error

Hello, I am new to working with Katalon studio, I use Record Web, I record and save the test, but when I run the test I get an error.
I have a question when displaying a list and selecting the elements I need when clicking on another part of the screen to close the list, but when I do this the following is recorded: div_Erase-mat -slide-toggle-bar-slide-t_514708
when running the test it marks an error in this step with the following text: Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: 'Object Repository / Page_Plataforma Gestin de Orden / div_Element_mat-slide-toggle -bar mat-slide-t_514708 ‘located by’ // mat-slide-toggle [@ id = ‘mat-slide-toggle-17’] / label / div 'not found

You are having to click on another part of the screen to close the list because you have added a WebUI.click(‘yourDropDown’) to your script. Instead, you could comment out this click event. This way you do not have to “close” the drop-down afterwards,

If you leave the click event in, then you could change the element that you use to close the drop-down. The xpath of the element you use can be changed from clicking on a div to using the label:

//mat-slide-toggle[@id=‘mat-slide-toggle-17’]/label/div

to:

id("mat-slide-toggle-17")/label
or
//mat-slide-toggle[@id='mat-slide-toggle-17']/label

Hello good afternoon.

Sorry for taking a long time to respond, I had a problem with katalon and I could not recover the test I was doing, I had to reinstall katalon and record again, the test, the line that is saved is the following:

WebUI.click (findTestObject (‘Object Repository / Page_Order Management Platform / div_Nestor_cdk-overlay-backdrop cdk-overlay_5982a2’))

I comment it by putting not_run at the beginning, but mark error in the next step does not detect the add button

Error: Caused by: org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element … is not clickable at point (874, 538). Other element would receive the click:


I share image of the code

Can you help me? please

Try WebUI.enhancedClick

1 Like

good day
use the code that you indicated, when running the test marks the following error
Caused by: java.lang.IllegalArgumentException: Object is null

image

If you copied the text that @kazurayam put within his response to you, and pasted it within your Test Case, you have to change the smart quotes (they have a curve or curl to them) into straight quotes–you can fix them by just retyping the quotes within KS. Then you can try running your test again.

Hello.
I already corrected the quotes as they indicated to me, the line is as follows:
WebUI.enhancedClick(findTestObject(‘Object Repository/Page_Plataforma Gestin de Pedidos/div_Nestor_cdk-overlay-backdrop cdk-overlay_5982a2’))

But it marks the following error:
Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Page_Plataforma Gestin de Pedidos/div_Nestor_cdk-overlay-backdrop cdk-overlay_5982a2’ located by ‘//div[4]/div[3]’ not found

You will have to use DevTools to review the HTML and the xpath of your element. The error message indicates the xpath, //div[4]/div[3] does not exist at the time you are testing that specific element.

This TestObjectId has a part 5982a2. You should pay attention to it.

Please look at HTML source of the web page and find how the HTML element looks like. It could be, for example;

       <div id="xxxxxx">

The xxxxxx once was 5982a2 when you made the Test Object Page_Plataforma Gestin de Pedidos/div_Nestor_cdk-overlay-backdrop cdk-overlay_5982a2 using the Record Web Utility. If you retrieve the HTML source to look at that element now, I am sure, the xxxxxx part would be different. Your web page is designed to have the xxxxxx part dynamically changing. The element <id id="5982a2"> is no longer there, will never be there again.

"How to select a HTML element with dynamic id" — this is a frequently asked question in this forum. Please search for previous posts. You will find a lot to read. And surely you will find some of them informative.

Please note that you should study XPath or CSS Selector technology so that you can write an appropriate locator manually. The Record Web Utility is not helpful as far as dynamic id is concerned.

The solution for your case depends on how the HTML source is coded. You haven’t showed it to us yet, so we can not offer you any copy&paste-able answer.