Unit testing - Assert Popup Message Box

Asked by Q17 on 2017-10-31

Hi,

I have used the code below to verify if the image of a popup exists or not but it failed and it does not say why:

def testA(self):
        click(image1)
        wait(1)
        assert exists(PopUpImage)

Result -
File "C:\Installs\SikuliX\Validation.sikuli\Validation.py", line 10, in testA
assert exists(PopUpImage)

Can someone please tell me why does not recognize the popup?

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2017-10-31
Last query:
2017-10-31
Last reply:
2017-10-31
RaiMan (raimund-hocke) said : #1

this line
File "C:\Installs\SikuliX\Validation.sikuli\Validation.py", line 10, in testA
assert exists(images2)

is not from your posted def testA

Q17 (squery) said : #2

Sorry it should be:

File "C:\Installs\SikuliX\Validation.sikuli\Validation.py", line 10, in testA
assert exists(PopUpImage)

Best RaiMan (raimund-hocke) said : #4

exists does not tell you anything but True or False.

If you want information, you have to use find/wait and catch the FindFailed exception.

... but this will not give you more information: if exists returns False, the image is not found within 3 seconds on the screen.

So you have to check your click... workflow.

Q17 (squery) said : #5

Ok thanks I will try find method.

Q17 (squery) said : #6

Thanks RaiMan, that solved my question.