I'm currently torn on whether this is verifiable or not. First, I think there is some way to get the attribute value from a mobile element. However, after my observation I noticed they have two different attribute names, text
for Android and value
for iOS. O_O Our team is currently aiming to do one script for both Android and iOS by accessing the elements using accessibility ID
. But... we have a test case that needs to verify if changes where correct after saving. Do we have a way to do this?
Note: We are running this in Saucelabs and Github Actions. One test script for both Android and iOS.
You could write your tests with page factory (Page Object design pattern), this way you can specify one WebElement with a different selector per platform:
@iOSXCUITFindBy(accessibility = "yourSelector")
@AndroidFindBy(xpath = "yourSelector")
private WebElement yourWebElement
Text / value can be read by one and the same method for both platforms like so:
yourWebElement.getText();
(Examples in Java) Documentation here.