Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions AppiumLibrary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class AppiumLibrary(
| chain | Click Element `|` chain=XCUIElementTypeWindow[1]/* | Matches by iOS Class Chain | |
| css | Click Element `|` css=.green_button | Matches by css in webview | |
| name | Click Element `|` name=my_element | Matches by @name attribute | *Only valid* for Selendroid |
| imagef | Click Element `|` imagef=path/to/image/file | Matches by image | Only Available for NATIVE \
Context - Check PR: #291 |

== Using webelements ==

Expand Down
7 changes: 7 additions & 0 deletions AppiumLibrary/locators/elementfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def __init__(self):
self._strategies = {
'identifier': self._find_by_identifier,
'id': self._find_by_id,
'imagef': self._find_by_image,
'name': self._find_by_name,
'xpath': self._find_by_xpath,
'class': self._find_by_class_name,
Expand Down Expand Up @@ -119,6 +120,12 @@ def _find_by_chain(self, browser, criteria, tag, constraints):
browser.find_elements_by_ios_class_chain(criteria),
tag, constraints)

def _find_by_image(self, browser, criteria, tag, constraints):
"""Find element matches by image file."""
return self._filter_elements(
browser.find_elements_by_image(criteria),
tag, constraints)

def _find_by_default(self, browser, criteria, tag, constraints):
if criteria.startswith('//'):
return self._find_by_xpath(browser, criteria, tag, constraints)
Expand Down
4 changes: 2 additions & 2 deletions docs/AppiumLibrary.html

Large diffs are not rendered by default.