I wrote the test case for submit the form but after click submit.
There is the message confirmation pop up instead alert pop up.
I cannot use web spy to capture, and when I record web it disappear so quickly.
Is any way to caption object? Thanks in advance
Hi @nancy.chen, This may help you: Solving Pop-up dialog issue with Katalon Studio | Katalon Docs
This article work for alert pop up not for confirmation message pop up. I try alert but show me error that it cannot find alert. Thanks
@nancy.chen If you are only at the stage of getting objects via Web Spy, you may not, however, if you extend yourself, you may be able to create an object that would be like clicking on the OK button or Cancel button, but you would have to create the object in the Object Repository yourself.
- If you right click on the folder under Object Repository that you want the new object, then select “New > Test Object”, give the new object a name**, then click OK.
- For the new object, select Add, and for Name put in
tagand for Value, put in
- Select Add again, and for Name choose
xpathfrom the drop-down and for Value, put in
//button[text()="OK"](this is such a simple text that if you have more like it within your application, that the button may not work),
- In your Test Case, add the statements where this confirmation pop-up would appear,
WebUI.switchToWindowIndex(1) // this may not be necessary WebUI.waitForElementVisible(findTestObject('your new object'), 10) WebUI.click(findTestObject('your new object'))
And I hope this works for you. Edit: you should try with the
switchToWindowIndex() and without it.
To make another object for the Cancel button, do the same for object number 2 but obviously change the text to “Cancel”.
**Edit: we use the following 3-part rule to name our objects. The first part is based on the tag, such as “button”. The second part is based on the section of the page where the object is–in this case, maybe “Confirm”. The last part is based on the nearest label–you may use the text you crossed out in red. So, you could put:
Excellent work-around @grylion54.
If you have more that one OK button on the page you could use: (//button[text()=“OK”]) to pick the first or (//button[text()=“OK”]) to pick the second and so on. You could also use (//button[contains(.,‘OK’)]) or (//button[contains(.,‘Cancel’)]).
Before it execute WebUI.switchToWindowIndex(1), pop up window already disappear. I did try all wait for element and delay. But pop up window disappear before execute next line. I try inspect from browser, I couldn’t find any related popup window. I think it is from server side direct?
As Mike said above using ‘WebUI.switchToWindowIndex(1)’ may not be needed…
Assuming your object name is ‘OK_button’, try this…
The delay can be increased/decreased if needed.
WebUI.click(findTestObject('Submit_button')) WebUI.delay(1) //Sets hard 1 second wait time for the popup window. WebUI.waitForElementVisible(findTestObject('OK_button'), 10) WebUI.click(findTestObject('OK_button'))
Hi @nancy.chen - You can use String ConfirmationMessage=WebUI.getText(findTestObject(‘Object Repository/…’)) method