Hello
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
Hi
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
tag
and for Value, put inbutton
, - Select Add again, and for Name choose
xpath
from 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:
button.Confirm.yourHiddenTextHereOk
Excellent work-around @grylion54.
If you have more that one OK button on the page you could use: (//button[text()=āOKā])[1] to pick the first or (//button[text()=āOKā])[2] to pick the second and so on. You could also use (//button[contains(.,āOKā)])[1] or (//button[contains(.,āCancelā)])[1].
@grylion54
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?
Hi @nancy.chen,
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
Hey,
I have found a solution to click on OK button of pop-up message
In this video at 9:30 follow the dude and go to built-in keywords, here you have Katalon functions to Confirm pop-up message.
Hi there,
Thank you very much for your topic. Please note that it may take a little while before a member of our community or from Katalon team responds to you.
Thanks!