← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #239566]: Automate a log in page which has Number pad.

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
a number pad usually is some stable geometric pattern having clickable
areas (a calendar selector e.g.).

So you just have to evaluate the geometrics of the pad, define its
region with respect to other already found visuals and click a pad item
by calculating its position.

This approach is one of the most overseen things in Sikuli, since Sikuli
allures to use click(image) instead of click(point), where point is some
evaluated point on the screen.

This is from my solution to login to my bank account.
You have to add the missing digits of your secret at the top by clicking the number pad.

login = wait("LoginDiba.png", 10)
rightClick(login); wait(1)
Region(login.below()).click("1Passw0rd10D.png")
pad = wait("DibaPad.png", 30)

distH = 120
distV = 50
n1 = pad.offset(Location(-122,-76)).getCenter()
nall = []
for n in range(4):
    for k in range(3):
        nall.append(n1.offset(k*distH, n*distV))

guess = find(Pattern("KeyEingabe.png").targetOffset(203,79))
x = guess.getTarget()
g1 = Region(x.x, x.y, 1, 1).nearby(30)
gset = "dot.png"
dist = 60
for i in range(6):
    g = g1.offset(Location(i*dist, 0))
    key = int(code[i])-1
    if key < 0: key = 9
    if not g.exists(gset,0):
        click(nall[key]); wait(1)
    
click(pad.offset(Location(100,150)))
wait("GutenTagRaim.png", 30)

the pad looks like this:
https://dl.dropboxusercontent.com/u/42895525/numberpad.png

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