- Over Appium1.6.0 provides
XCUITest
automation name based on WebDriverAgent. - How to migrate XCUITest from UIAutomation
- Mobile gestures for XCUITest
- ios-xctest-mobile-gestures
- Required Appium1.6.4+
- supported elements by find_element are:
- Mapping
- button_class, static_text_class, text_field_class and secure_text_field_class provide class name.
- If
automationName
isAppium
ornil
, then they provideUIAxxxx
- If
automationName
isXCUITest
, then they provideXCUIElementTypexxx
- If
find_element(:class, button_class) # Return a element of XCUIElementTypeButton for XCUITest
-
tag/s is alias of
find_element :class, element
-
accessibility_id
find_element(:accessibility_id, element) # Return a element which has accessibilityIdentifier, `element`.
button/s(value)
,button_exact/buttons_exact
,text/s(value)
,text_exact/texts_exact
buttons(value) # Return button elements include `value` as its name attributes.
- We recommend to use predicate strategy instead of XPath strategy.
- e.g.
find_ele_by_predicate/find_eles_by_predicate
,find_ele_by_predicate_include/find_eles_by_predicate_include
- e.g.
- A helpful cheatsheet for predicate
- For XCUITest(WebDriverAgent), without 'wd' prefixes are supported.
- https://github.com/facebook/WebDriverAgent/wiki/Queries
- For example,
%(name ==[c] "#{value}" || label ==[c] "#{value}" || value ==[c] "#{value}")
is equal to%(wdName ==[c] "#{value}" || wdLabel ==[c] "#{value}" || wdValue ==[c] "#{value}")
in WebDriverAgent.
textfield/s(value)
,find/s
,find_exact/finds_exact
,find_ele_by_predicate/find_eles_by_predicate
andfind_ele_by_predicate_include/find_eles_by_predicate_include
use predicate strategy in their method.
textfield(value) # Return a XCUIElementTypeSecureTextField or XCUIElementTypeTextField element which has `value` text.
finds_exact(value) # Return any elements include `value` as its name attributes.
- require Appium 1.6.4+
- WebDriverAgent
- It is better to avoid XPath strategy.
- https://github.com/appium/appium/blob/v1.6.2/docs/en/advanced-concepts/migrating-to-xcuitest.md#xpath-locator-strategy
-
Try not to use XPath locators unless there are absolutely no other alternatives. In general, XPath locators might be times slower, than other types of locators like accessibility id, class name and predicate (up to 100 times slower in some special cases). They are so slow because XPath location is not natively supported by Apple's XCTest framework.
-
- Improved performance a bit
- https://github.com/appium/appium/blob/v1.6.2/docs/en/advanced-concepts/migrating-to-xcuitest.md#xpath-locator-strategy
- XPath in WebDriverAgent
xpaths("//some xpaths")
mobile:
commands are provided by WDA.- Documentations
- Specs by test code
mobile:
commands depends on WDA and Apple's framework and the behaviour depends on them.- Sometimes issues occur such as "doubleTap isn't tapping #548"
- workaround for it:
- with
selenium-webdriver >= 3.4.0
def double_tap(element) rect = element.rect execute_script 'mobile: doubleTap', x: rect.x + rect.width / 2, y: rect.y + rect.height / 2 end
- with
selenium-webdriver < 3.4.0
def double_tap(element) size = element.size location = element.location execute_script 'mobile: doubleTap', x: location.x + size.width / 2, y: location.y + size.height / 2 end
- with
- workaround for it:
Basically, other actions such as type
are compatible with automationName = Appium
.