How-to: AI Using Appium

In this demo, we will try using the Test.ai classifier plugin with Appium.

Install all Dependencies

circle-exclamation

Open a terminal, and execute the following:

brew install pkg-config cairo pango libpng jpeg giflib
brew install nvm

Add the following to ~/.zshrc or your desired shell configuration file:

export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"  # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm"  # This loads nvm bash_completion

Next, execute the following:

nvm install v14.16.1
nvm use v14.16.1
npm install -g npm
npm install -g appium
npm install -g test-ai-classifier

Start Appium Server

appium

Start Test.ai Classifier Server

Appium Pro Sample Project

Clone the repository located herearrow-up-right.

Open the java folder inside of your favorite Java IDE (IntelliJ recommended) and use the Gradle IDE features to install dependencies. IntelliJ does this automatically.

Open the Edition039_AI_For_Appium.java file and replace the contents with the file below.

Edition039_AI_For_Appium.java

Next, look for the following line of code, and replace 13.4 with the correct iOS version for the iPhone 8 simulator installed on your machine. You may use idb list-targets to find this information.

Finally, execute the test case. If everything executes as expected:

  1. The Photos app will launch on an iOS simulator.

  2. The Albums icon will be tapped using a standard Appium selector.

  3. The Search icon will be tapped using AI-based selection via Test.ai's classifier.

circle-info

The test.ai classifier that is installed out of the box has been pre-trained. You may train your own classifier by following the next tutorial.

Last updated