I have this GUI on our project (please bear with my illustration, I'm not allowed to take a screenshot at work)
----------------------------------------------
(1) Header |
----------------------------------------------|
(2) Files | (3) | Drop-down button (Options)
----------------------------------------|-----|
| |
----------------------------------------|-----|
| |
----------------------------------------|-----|
| |
-----------------------------------------------
I need to test one file in each file type our product can support. The ultimate goal is to use that (3) drop down button. Here is the summary of my code when I'm in this part
find_filetype = find.imagedict(filetypeicon.png) #(2) filetype
freg = find_filetype.right()
if freg.exists(drop-down.png): #(3) drop-down icon
freg.click(drop-down.png)
Now after clicking (3), a drop-down menu with 4 action items will appear. So for example if I click (3a): it will appear below from (3b - 3d) showing at least 2-3 drop-down items.
----------------------------------------------
Header |
----------------------------------------------|
| (3a)|
----------------------------------------------|
| (a1) | | #a1 = action 1
--------------------------------|---------|---|
| (a2) | | #a2 = action 2
--------------------------------|---------|---|
|__(a3)___| |
-----------------------------------------------
If I click (3c): The drop-down menu will choose to appear above (f.a.d.) Showing at least 2 drop-down items.
----------------------------------------------
Header |
----------------------------------------------|
| (a1) | |
--------------------------------|---------|---|
| (a2) | |
--------------------------------|_________|---|
| (3c)|
----------------------------------------|-----|
| |
----------------------------------------------
My workaround for this are :
screenshot all action items and
if/elifs + dragDrop()
which makes my scripts slow (I perform hundred of iterations everyday)
Is there a way I can find (a1) (because its always present after clicking (3)), save its coordinates and use it as a param for scrolldown_codes like this
#after clicking drop-down
#find and get (action1) coordinates
def scroll_down(coordinates): #pass it here
while not exist(action(n).png): #n = action choice
end_Y = coordinates
start_Y = coodinates - few_Y
dragdrop(start_Y, end_Y)
wait(1)
click(action(n).png)
Please help me! Feel free to suggest anything helpful!
Note: Im only allowed to click and drag while on that GUI because its a touchscreen product we're developing.