I´ve run a sucessful test for an iPar Air 2 from chosen from the Amazon device farm. Then I run the same test after selecting iPhone 5s from Amazon device farm and it fails. The error message says “noSuchElementException”. The test is written in Java, and Both devices have iOS 10.2.
Does somebody know why is this happening?
Different versions of devices can have different UI’s, and sometimes the same selector will not work.
Unless there’s an underlying bug or misconfiguration, the answer is going to be tweaking your selector. Are you using XCUITest, and if so, are predicates your selector method?
You could post the selector here, but most likely you will just need to inspect the UI of your app, and craft a selector that will work on both platforms.
Also, make sure the app is open, and that other parts of the Appium connection are working fine.
I am using is XCUITest, and my selector method is:
WebElement alert = driver.findElement(By.className(“UIAAlert”));
So should I to assert that the class UIAAlert is not suitable for an iphone? Then How cani I reffer to an UIAAlert object on an iphone device?
Are you certain that the element appears on the current page? You can do something comparable to (this python example:
logging.debug(driver.page_source())
There will be some Java equivalent I’m sure, and this will allow you to confirm which page Appium thinks it’s one, and help you both make sure it contains the element you’re trying to select, and give you the details of what fields the element has.
Are you watching the screen? One thing I found in testing is that smaller errors can lead to issues like this by, say, an attempt to switch pages in the app failing.
selectLoginWithEmail failed: An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 910 milliseconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html Build info: version: ‘2.48.2’, revision: ‘41bccdd10cf2c0560f637404c2d96164b67d9d67’, time: ‘2015-10-09 13:08:06’ System info: host: ‘ip-172-31-13-65’, ip: ‘172.31.13.65’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘3.13.0-53-generic’, java.version: ‘1.8.0_65’ Driver info: io.appium.java_client.ios.IOSDriver Capabilities [{app=com.ibermatica.PruebaAppium, networkConnectionEnabled=false, appiumVersion=v1.6.0, xcodeOrgId=DXKN9UUK5Q, databaseEnabled=false, deviceName=IPad Air2, xcodeSigningId=iPhone Developer, platform=MAC, realDeviceLogger=/usr/local/lib/node_modules/deviceconsole/deviceconsole, platformVersion=10.2.1, webStorageEnabled=false, locationContextEnabled=false, browserName=, takesScreenshot=true, javascriptEnabled=true, platformName=iOS, udid=278d7a1371d7a4fc9e2eb0b4639c70969e0eaaa3}] Session ID: 55054aef-5092-4d0a-a77b-8c0eb3ae2205 *** Element info: {Using=class name, value=XCUIElementTypeAlert}
On a failure like this I will often do a driver.getPageSource. You could do this before the call that fails and then see what is in the screen. I’m suspecting that this might be a good use case for an implicit wait, but not entirely sure.
Hello
The issue has been fixed by rewitting the app code in such a way that all the text boxes, and the login button appear into the device´screen, for ipad as much as iphone.
Thank you very much for your suggestions.