← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #201557]: Object null reference error on a button click in a windows client app

 

Question #201557 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/201557

    Status: Needs information => Answered

RaiMan proposed the following answer:
might be a timing problem:

    assert exists (imgUserId)
waits 3 seconds for the imgUserId image to appear.

Since you catch the assert exception and let the script continue, getLastMatch() is None, which leads to the Java null pointer exception.
Your approach does not make much sense, since when the password field is not found, continuing the script is useless.

If you start the app forefront, the image is already visible.

This could be my code:


App.open("C:\Program Files (x86)\AUT\Client\AUT.exe")

imgUserId =("LWe_.png")
click(wait(imgUserId, 10)) # give max 10 seconds
type("a",KEY_CTRL)
type("userid@xxxxxxx")

imgPassword =("1340666502867.png")
click(imgUserId) # no additional wait necessary, should be there
type("a",KEY_CTRL)
type("mypassword")

imgSignin =("Sgnn.png")
click(imgSignin) # no additional wait necessary, should be there

In any case, if one of the image searches fail, the script will abort
with a FindFailed exception.

if you want your own message:
e.g.
if not exists(imgUserId, 10): print "imgUserId not found"; exit(1)
click(getLastMatch()

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.