admc / wd

A node.js client for webdriver/selenium 2.
Other
1.53k stars 402 forks source link

elementByImage works for simpler images #558

Closed zbranzov closed 5 years ago

zbranzov commented 5 years ago

Hi, elementByImage is a great new feature but it seems a bit unreliable yet. In some cases, it does find my image on the screen but only for very simple images. If I use for example a more complex one it won't. A real example is this image https://screencast.com/t/K9GGCPZ7Q that does not get matched on the screen but if I look only for the 'blue square' it does. So I wonder if there is a way to get the device screenshot and try to find why it does not match with my reference image? Now I have only the reference image and can't get further.

zbranzov commented 5 years ago

I just captured the clicks in order to see what is going wrong. In the video https://screencast.com/t/u2BobJLzst you will see that the click is not happening in the center of the image we are looking for. So in the case with the simpler image "blue square" it clicks on top of it but still able to click. On the other side, when looking for the more complex image above, it clicks too far above the matching center. In my code I'm using : wd.updateSettings({imageMatchThreshold: 0.9}); wd.updateSettings({autoUpdateImageElementPosition: true}); wd.updateSettings({fixImageTemplateSize: true});

jlipps commented 5 years ago

Hi there, thanks for the report. It does seem you've run into a legitimate issue, however it has to do with the behavior of the Appium server and not this library. Please report it at https://github.com/appium/appium/issues!