Can I use appium to test web applications?

The application I'm testing is a web application. Can I use Appium to verify this? Their website says: "Appium is an open source testing automation system for use with native and hybrid mobile applications."

Therefore, I am not sure if this will work for my web application, as it is not a native application or a hybrid application.

Can someone enlighten me?

Thanks!

+7
appium
source share
6 answers

First of all, you need to know which web application you want to test. According to Saucelabs

There are three types of web applications:

  • Native application
    Yes, you can test it with Appium, which is a popular tool for testing mobile devices.
  • Hybrid app (native + web browsing)
    Yes, you can test it with Appium, but with a little trick that you may need to change the context in order to switch to web view mode. appium.io
  • Web application (an application accessible from a browser installed on your mobile device, not one that you can download and install)
    Yes, and the details are on appium.io too.

In addition, there is a really different type of application: a hybrid application, but with customizable web browsing.
I recently struggled with this because it is difficult for me to find and switch to web browsing mode.

+8
source share

Yes, I'm sure you can, look here:

EDIT: deprecated link fixed link to appium doc

Also, a related question here

+2
source share

Perhaps here is an example of how to create an instance for a safari in Ruby:

opportunities = {

:device => 'iPhone Simulator', :browserName => 'iOS', :version => '7.1', :platform => 'Mac', :app => 'safari' } $mobile_browser = Selenium::WebDriver.for( :remote, :desired_capabilities =>capabilities, :url => "your_server/wd/hub") 

before downloading appium and click "Run" to start the application server.

+1
source share

I found Appium very cumbersome when testing mobile web applications because touch actions are not well supported. From a Java perspective, I found there two main options for communicating with Appium: Selenium RemoteWebDriver and AppiumDriver from the Appium Java client .

Selenium RemoteWebDriver

So far, I have been able to test our web application on an Android device using the selenium RemoteWebDriver and RemoteTouchScreen. Using Selenium 3.6.0 and Appium 1.6.5, I tested 4 different methods to click an element:

 webDriver.findElement(locator).click(); new Actions(webDriver).moveToElement(findElement(locator)).click().perform(); new RemoteTouchScreen(new RemoteExecuteMethod(webDriver)).singleTap(((Locatable)webDriver.findElement(locator)).getCoordinates()); new TouchActions(webDriver).singleTap(locator); 

On Android, the first three methods work, but 4 throws a "not supported" exception. I decided to use method 1 for clicks / taps and 3 for gestures.

On iOS, methods 1, 2, and 4 throw an โ€œnot yet supportedโ€ exception, and method 3 does nothing. Since I was not ready to spend time troubleshooting, we are only testing Android now, hoping the Appium will be improved and iOS will be better supported.

Appium Java Client

My experience with the Appium java client (version 5.0.4) was even worse. There seems to be no comprehensive tutorial on how to do sensory actions, only a few pieces of code flying around firewalls. Therefore, my answer to this question is an attempt to create it.

First create an instance of the driver and go to the page:

 DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("deviceName", "Samsung Android S8"); capabilities.setCapability("browserName", "Chrome"); capabilities.setCapability("platformName", "Android"); MobileDriver appiumDriver = new AndroidDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); appiumDriver.navigate().to("https://duckduckgo.com"); 

Then do the touch action:

 new TouchAction(appiumDriver).tap(appiumDriver.findElement(By.id("search_form_input_homepage"))).perform(); 

The result is: org.openqa.selenium.WebDriverException: the method has not yet been implemented.

From this forum post I realized that I need to switch context in order to be able to do sensory actions. Try two:

 appiumDriver.context("NATIVE_APP"); new TouchAction(appiumDriver).tap(appiumDriver.findElement(By.id("search_form_input_homepage"))).perform(); 

It works. However, only for the By.id. selector. I could not find any other selector that works in the context of NATIVE_APP. And since most elements of our website lack an identifier, I need an xpath selector. Try three:

 appiumDriver.context("NATIVE_APP"); new TouchAction(appiumDriver).tap(appiumDriver.findElement(By.xpath("//*[@id=\"search_form_input_homepage\"]"))).perform(); 

The result is: org.openqa.selenium.NoSuchElementException: the element could not be found on the page using the specified search parameters.

Other workarounds that I could come up with, such as selecting a WebElement in the CHROMIUM context and then moving the location to the NATIVE_APP context, is not an option as the coordinate systems are different (browser pixels and screen pixels).

And don't forget to revert to the default CHROMIUM standard after each touch action. Thus, the full code of only a working example will look like this:

 try { appiumDriver.context("NATIVE_APP"); new TouchAction(appiumDriver).tap(appiumDriver.findElement(By.id("search_form_input_homepage"))).perform(); } finally { appiumDriver.context("CHROMIUM"); } 

At this point, I came to the conclusion that testing mobile web applications with Appium is not yet complete.

+1
source share

If you are talking about mobile web applications, yes, you can use Appium to test them

0
source share

Yes, Appium can test both native and hybrid applications.

For a Windows machine, download: Appium For Windows. For the MAC machine, download the Appium dmg file.

Need for Windows: Only Appium.exe + .apk (Android) + test device + Android SDK installed.

MAC is required Appium DMG file + .app / .ipa + test device + XCODE (security certificate) + ANT + ios-webkit-proxy-debug.

For web applications, since they are based solely on the browser, Appium works well with them.

Reference link: https://github.com/appium/appium/blob/master/docs/mobile-web.md

-one
source share

All Articles