-
Notifications
You must be signed in to change notification settings - Fork 568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use normal element #236
use normal element #236
Conversation
appium/webdriver/webdriver.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah =>
python-client/appium/webdriver/webdriver.py
Line 111 in c6f58bc
By.IMAGE = MobileBy.IMAGE |
-
As a user, if users should imagine what logic is used behind the method, it's better to use
template
since it help users clalify the behaviour, I think. Then, I'd like to define-image template
as the selector though. -
We defined the selector as
-image
. Then, usingimage
in bothBy
andSelector
is 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is no necessarily a png file. The format might be anything support by OpenCV itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡
appium/appium-base-driver#235 was merged. Thus, we can remove customised image elements introduced in #224 since we can get coordinates by
rect
,location
andsize
, 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/rect
after getting a result of-image