← Back to team overview

sikuli-driver team mailing list archive

[Question #689848]: Is there a way of ensuring that only the required number of clicks are carried out?

 

New question #689848 on Sikuli:
https://answers.launchpad.net/sikuli/+question/689848


I have an app which is designed to automate certain aspects of an auction process. The app cycles through the auction catalog to gather specific information on each item available. The catalog has the following format:


<LB>                                                                                                                                                                                 <RB>

[x]  [1]   [4]    [7]   [8]   [10]...................................................................................................................................
       [2]   [5]            [9]   [11].....................................................................................................................................
       [3]   [6]                    [12}....................................................................................................................................

The catalog is made up of multiple columns and each column can have 1,2 or 3 items  in it. If you click on an item it drills down to give more detailed information on the item. Once you click back from the detailed information you are placed back at position [x] ( a design feature over which I have absolutely no control).

I have designed the sub-routine below to cycle through the items and position the cursor at the first item in a column. The <LB> and <RB> are clickable and move 6 columns across the catalog. The issue I am having is that when I use the loop to cycle to the correct column a variable number of clicks is being executed which means  that the cursor is not landing in the correct place and sometimes duplicate information is loaded, other times if more clicks than needed are executed information is loaded out of sequence. I an

I have tried to include a test to ensure that the click is being executed, I have also put a wait in to see if that makes a difference, it doesn't. The UI is so fast that when there is no wait in you can't see the items scrolling across the screen. My question therefore is, is there a way to ensure only the correct number of clicks is being executed?

def goto_car_column(cols):
    right_tabs = 0
    right_jumps = 0
    Debug.user("The count at cols is.."+str(cols))
    wait(1)
    store_car ="Holder"
    quicksteps = (cols - 10) // 6
    normalsteps = (cols - 10) % 6
    while right_jumps <= quicksteps:
        click(Location(1566, 239))    
        car_reg = (Region(1340,221,151,31))
        read_car = car_reg.text()
    
        if store_car == read_car:
            click(Location(1566, 239))
            wait(1)
        else:
            store_car = read_car
            
        right_jumps +=1
        
    while right_tabs <= normalsteps:
   
#        type (Key.RIGHT)
        click(Location(958, 380))
        wait(1)
        right_tabs +=1

One thing to note as well is that the debug statement shows the correct value being passed to the routine.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.