← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #139606]: Need to take screenshots again after phone reboot

 

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

RaiMan proposed the following answer:
I Suppose you have to different windows one for each phone on your
screen side by side.

If it is possible to do the call generation on one phone and then
afterwards the incoming call handling on the other phone, then this is
no problem.

the principle script layout:

p1 = region-of-emulator-window1
p2 = region-of-emulator-window2

for i in range(10): # repeat the following 10 times

   with p1: # all subsequent actions happen in window of phone1
      click(number-entry)
      paste("123456789") # phone number
      click(dial-button) 
      # might be some more to do

   with p2: # all subsequent actions happen in window of phone2
      while not exists(sign-for-incoming-call):
          wait(1)
      # will wait forever if no call is coming in
      click(button-accept)
      # might be some more to do

   pass # now the 2 blocks are repeated

the pass statement is simply a "no-operation" in Python, that assures
correct indentation/dedentation as a placeholder.

If you have to jump from one phone to the other in between it is a bit more complicated, but principally the same:
- p1 dials
- p2 waits and accepts
- p1 check acceptance realized
- p2 do something
- p1 and check 
- p2 end call
- p1 check end call realized

The with: construct is a convenience, to block functions together, that act on the same region, so you do not have to qualify the functions with its region - e.g.
p1.click()
p2.click()

Principally it is possible to have the workflow on each phone in
threads, that are running in parallel. This might give you more
flexibility, but you would have to synchronize the use of mouse and
keyboard, since only one thread may use it at one time.

Sounds interesting in general ;-)

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