I’ve been tasked with testing how long a particular element takes to physically appear (a button that only appears after the app content has loaded) on our app ‘home’ page.
I was just wondering whether this can be done at code level, or whether this can only be found in logs?
I’m writing my appium test scripts for a native app, where the element is displayed sometimes after a few seconds, sometimes after a few minutes. I’ve been tasked with running a simple test 10 times and recording the time taken for the element to be displayed.
Ok, I’m going to suggest that you use an Implicit or Fluent wait. What you’ll want to do is write a wrapper for the wait that includes a timestamp before and after the wait in your wrapper. Subtract first timestamp from second and record this info somewhere. Here is a tutorial on using Webdriver waits. It has examples in several languages:
Note that while the examples in that document are for Selenium and webpages, these methods are fully available in Appium and can be used with any typical findElement commands, such as by id or xpath.