use normal element#236
use normal element#236KazuCocoa merged 6 commits intoappium:masterappium/python-client:masterfrom KazuCocoa:remove-image-elementKazuCocoa/python-client:remove-image-elementCopy head branch name to clipboard
Conversation
| with open(png_img_path, 'rb') as png_file: | ||
| b64_data = base64.b64encode(png_file.read()).decode('UTF-8') | ||
|
|
||
| return self.find_elements(by=By.IMAGE, value=b64_data) |
There was a problem hiding this comment.
in java I call this locator type By.imageTemplate. How do you think which one is more appropriate?
There was a problem hiding this comment.
ah =>
python-client/appium/webdriver/webdriver.py
Line 111 in c6f58bc
-
As a user, if users should imagine what logic is used behind the method, it's better to use
templatesince it help users clalify the behaviour, I think. Then, I'd like to define-image templateas the selector though. -
We defined the selector as
-image. Then, usingimagein bothByandSelectoris more appropriate, I felt.
Comparing 1 and 2, so far, 2 is enough, I think. (By.IMAGE is much enough.)
(I considered the naming, too 🤔 )
appium/webdriver/webdriver.py
Outdated
|
|
||
| return self.find_element(by=By.IMAGE, value=b64_data) | ||
|
|
||
| def find_elements_by_image(self, png_img_path): |
There was a problem hiding this comment.
it is no necessarily a png file. The format might be anything support by OpenCV itself
appium/appium-base-driver#235 was merged. Thus, we can remove customised image elements introduced in #224 since we can get coordinates by
rect,locationandsize, I think. right? @jlipps(Following Java and Ruby client did)
Tests:
You can see some commands like
/wd/hub/session/bf8df057-4e6d-4920-8be7-26b8a9fe9e68/element/appium-image-element-4810adbb-4c21-4c2d-a2be-be7dfd80f8dc/rectafter getting a result of-image