Closed fruwe closed 5 years ago
However, I could find and click the element using a cropped screenshot.
(byebug) e = appium_driver.find_element(image: cropped_icon_img)
#<Selenium::WebDriver::Element:0x..fcbc7ceedb89e4650 id="appium-image-element-1cca953b-2b38-485b-a372-27de01f0ad98">
(byebug) e.rect
#<struct Selenium::WebDriver::Rectangle x=534, y=150, width=310, height=260>
(byebug) e.click
nil
from appium/ruby_lib_core@590e798 , the finding image logic has moved to https://github.com/appium/appium/blob/master/docs/en/advanced-concepts/image-elements.md
The previous implementation was the experimental one in client-side. The new one was handled the same logic in appium-base-driver. So, for now, the process depends on Appium base driver's logic.
You can check what image is returned by the appium server using https://github.com/appium/ruby_lib_core/blob/ffe14bd8263becfc4cac1446dba62ca6544c886b/lib/appium_lib_core/common/device/image_comparison.rb#L85 . Internally, the previous implementation used the image comparison API which already implemented in ruby lib
ah, sorry. I misunderstood. I should have updated ruby_lib side.
✅ v10.2.0
thanks for the report!
This is a
Summary
Environment
ruby_lib
version: tried 10.0.0 (core 3.0.0) , 9.18.0 (core 2.3.4), master (https://github.com/appium/ruby_lib/commit/cc2757def15d29a5ff0d899a26bd131bf98d0653) (core master)Tried with UIAutomator and UIAutomator2
Actual behaviour and steps to reproduce
I have an Android view, with nearly white background and one button containing an enlarged version of a 32x32px icon image. The button's bounds are [531,172][831,392]. I am trying to press the element containing that image.
What I tried is
The problem is that in this area is no element, I tried to click it but it is not working,
nil
is returned. (In case of UIAutomator2 "OK" is returned)Furthermore, I tried to get an image of the element or other information, so I tried
find_element_by_image
.I also tried (as explained in the documentation) to output an image like this:
This causes an error, since the core library only declares a method with a single parameter.
Expected behaviour
should return nil/error if not found or the element containing the image. It should never return an element not mentioned in the page_source (or maybe in the page_source's of all contexts).
Link to Appium/Ruby logs
Any additional comments
find_element_by_image contained originally more parameters, but they were removed here: https://github.com/appium/ruby_lib_core/commit/590e7981f924524ba40b9d918b41af22cf14cc59