Помогите написать скрипт

Asked by Елена

Help me write a script. There are many photos on the page. Some of them are repeated. You need to find them and click on them. The script should not stop when scrolling down the page. Stopping the script is possible only when the page is completely scrolled by me to the end.

https://drive.google.com/file/d/1xYlUo1XyiesHYZc_eFUVc8rEBdXH_isn/view?usp=sharing

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was reopened

Revision history for this message
Елена (dfgflol) said :
#1

Мне помогут?

Revision history for this message
RaiMan (raimund-hocke) said :
#2

Sorry, but this forum needs English language.

Revision history for this message
RaiMan (raimund-hocke) said :
#4

For your eye the images are the same, but for SikuliX they have different size in pixels.

In such cases the find operation will not work as expected.
For exact matches you have to know the scaling factor and could try with Pattern().resize().

To give you an impression, try with this script:

img = "img.png" # see comment
pimg = Pattern(img).similar(0.8)

f = findAll(pimg)
while f.hasNext():
    m = f.next()
    print m
    m.highlight(2)

--- comment
I used a shot of the complete top left image

the printout:
M[161,148 201x133]IN(0) %100,00 C(261,214) [438/437 msec]
M[533,716 201x133]IN(0) %95,00 C(633,782) [438/437 msec]
M[63,385 201x133]IN(0) %83,76 C(163,451) [438/437 msec]
M[526,420 201x133]IN(0) %80,07 C(626,486) [438/437 msec]

All 4 images are found but the other 3 with bad scores (to be taken as exact match a score must be >0.99).
Wether lower scores are acceptable depends on your intention and the quality of the shots.

You might play with the above snippet and make your experiences.

Another challenge with your example: Currently there is no feature to select an image automatically, you always either need to use the mouse or give the coordinates for a capture.

Can you help with this problem?

Provide an answer of your own, or ask Елена for more information if necessary.

To post a message you must log in.