Skip to content

Commit 6222a62

Browse files
authored
add custom locator (#151)
1 parent 744db4e commit 6222a62

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.
33

44
## [Unreleased]
55
### Enhancements
6+
- Add custom locator in the future work
7+
- https://github.com/appium/appium-base-driver/pull/268/
8+
```
9+
@driver.find_element :custom, "f:foo"
10+
11+
```
612
713
### Bug fixes
814

lib/appium_lib_core/common/base/search_context.rb

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module SearchContext
77
FINDERS = ::Selenium::WebDriver::SearchContext::FINDERS.merge(
88
accessibility_id: 'accessibility id',
99
image: '-image',
10+
custom: '-custom',
1011
# Android
1112
uiautomator: '-android uiautomator', # Unavailable in Espresso
1213
viewtag: '-android viewtag', # Available in Espresso

test/unit/driver_test.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_default_timeout_for_http_client
8383

8484
# https://www.w3.org/TR/webdriver1/
8585
def test_search_context_in_element_class
86-
assert_equal 19, ::Selenium::WebDriver::Element::FINDERS.length
86+
assert_equal 20, ::Selenium::WebDriver::Element::FINDERS.length
8787
assert_equal({ class: 'class name',
8888
class_name: 'class name',
8989
css: 'css selector', # Defined in W3C spec
@@ -96,8 +96,10 @@ def test_search_context_in_element_class
9696
xpath: 'xpath', # Defined in W3C spec
9797
accessibility_id: 'accessibility id',
9898
image: '-image',
99+
custom: '-custom',
99100
uiautomator: '-android uiautomator',
100-
viewtag: '-android viewtag', uiautomation: '-ios uiautomation',
101+
viewtag: '-android viewtag',
102+
uiautomation: '-ios uiautomation',
101103
predicate: '-ios predicate string',
102104
class_chain: '-ios class chain',
103105
windows_uiautomation: '-windows uiautomation',

0 commit comments

Comments
 (0)