Here open this Alert pop up in 2 times

This one is my code:

WebUI.openBrowser(‘’)

WebUI.navigateToUrl(‘https://masterqa.insuredhq.com/home.php’)

WebUI.click(findTestObject(‘Object Repository/Page_InsuredHQ - Your Insurance management system/a_Click here’))

WebUI.setText(findTestObject(‘Object Repository/Page_InsuredHQ - Your Insurance management system/input_Email address_username’),
‘usersupport@insuredhq.com’)

WebUI.setEncryptedText(findTestObject(‘Object Repository/Page_InsuredHQ - Your Insurance management system/input_Password_password’),
‘YjXSYnwzusPvQ4YWUCJaIqezUF6xI6Rd’)

WebUI.click(findTestObject(‘Object Repository/Page_InsuredHQ - Your Insurance management system/input_Password_login’))

WebUI.maximizeWindow()

WebUI.setText(findTestObject(‘Object Repository/Page_InsuredHQ - Your Insurance management system/input_Creditors_client’),
‘ghost’)

WebUI.click(findTestObject(‘Object Repository/Page_InsuredHQ - Your Insurance management system/button_Search’))

WebUI.click(findTestObject(‘Object Repository/Page_InsuredHQ - Your Insurance management system/i_1100_fa fa-wrench’))

WebUI.waitForElementClickable(findTestObject(‘Object Repository/Page_InsuredHQ - Your Insurance management system/i_InsuredHQ Core_fa fa-random’),
70)

String js = ‘$(“.policy_options”).click();’

WebUI.executeJavaScript(js, null)

if i am executing this code

String js = ‘$(“.policy_options”).click();’

WebUI.executeJavaScript(js, null)

I am getting 2 pop up so how can i handle this alert pop up in dynamic way? can i close this previous alert pop up ? but i can not capture close (X) button xpath in katalon studio

Please help me

Please Check screenshot

I have a few questions:

1.) Do both popups appear after a single click? If so, is that the expected behavior of the application?
2.) Are both popups identical?
3.) Can you share the HTML for the popup(s)?

Answer 1: Yes Appear After Single click & Expected behavior is only one pop up open for one click
Answer 2; Both Pop up are same
Answer 3: Yes sure

Please Check Below Screenshot

Does this also happen when you manually click?

Nop, Not happening For Manual Click

Ok then your approach should not be to handle both popups. You should instead try and figure out why you are getting two of them in the first place. Try just clicking with WebUI instead of JavaScript.

Ok thank you currently its working now