6

I initially wrote a few selenium scripts to test my web application. The scripts use RemoteWebDriver call for initialising web driver.

I now wanted to run the same scripts to test the web application on iOS and Android devices. I had to replace the RemoteWebDriver call with iOSDriver or AndroidDriver call with the grid URL since the device I am using is remotely hosted and the web page under test use native elements(eg: spinner for dropdowns or date selector on iOS)

However, I noticed that this introduces a huge performance lag.

From what I read online, I found that:

  • When finding elements on an iOS app, use findElementByIosUIAutomation or findElementByAccessibilityId rather than using XPath because using IosUIAutomation natively interacts with its UIAutomation framework, giving better performance. Does this mean using native selectors like xpath, ID, css will cause performance issues??

  • Running appium test has a built-in delay of 1 second between every request

Should there actually be a performance hit when using iOSDriver and AndroidDriver(5 times the time taken by RemoteWebDriver) or am I doing something wrong?

4
  • You are mixing multiple questions. Even if XPATH might cause lag, ID, NAME and CSS (which are recommended to use for location over XPATH by many online experts) might not. Don't put them all into one bucket, they are different, and will behave differently. Commented Nov 13, 2017 at 17:38
  • @PeterMasiar I agree to your point. But my question in generic to the performance of driver instance. It is independent of the locating strategy since all three driver instances will use the same locating strategy. Commented Nov 13, 2017 at 17:56
  • Do you observe same performance lag for ID/CCS as you observe for XPATH? I would expect ID and CSS be faster than XPATH. Commented Nov 13, 2017 at 18:02
  • There is very little improvement I can notice between the locating strategies (probably a few seconds for a test running for 15 minutes). Which probably indicates it has more to do with the driver instance type. Commented Nov 13, 2017 at 19:45

2 Answers 2

1

You can instantiate driver like as given below:

public static AppiumDriver <MobileElement> driver;

if (Platform_Name.equalsIgnoreCase("ios")) {

driver=new IOSDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

else {
driver=new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
0

Xpath is typically the slowest and most fragile way to match with selenium/appium. If you do use xpath ensure its anchored to the body to avoid ambiguity. It's best to use element IDs. If you use these your accessibility gets tested earlier and your Devs get less problems adding things later.

It sounds like your appium server isnt set up right if you are getting delays that long. Have you looked at the log files for the appium server ? They should be illuminating on why the delay is happening, if not crank the verbosity. You haven't said enough about your server for me to offer more info.

You can get the best network performance from an iPhone by plugging in a usb ethernet adapter into it via an apple AV adapter, this is how apple test stuff and if this isn't fast enough your setup isn't right.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.