Get the App
SLTechnology News&Howtos  ›  Servers  › 

How does Appium test ContactManager.apk

Shulou Source: shulou.com Published: 2022-05-31 12:16:12 10月06日 Update

Most people do not understand the knowledge points of this "Appium how to test ContactManager.apk" article, so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "Appium how to test ContactManager.apk" article.

Download ContactManager.apk

Install ContactManager.apk

C:\ Program Files (x86)\ Android\ android-sdk\ platform-tools > adb install D:\ xxx\ ContactManager.apk

Java Code:

Import java.net.MalformedURLException

Import java.net.URL

Import java.util.List

Import org.openqa.selenium.WebElement

Import org.openqa.selenium.remote.CapabilityType

Import org.openqa.selenium.remote.DesiredCapabilities

Import io.appium.java_client.MobileElement

Import io.appium.java_client.android.AndroidDriver

Public class ContactManagerAppTest {

Public static void main (String [] args) throws MalformedURLException {

DesiredCapabilities capabilities = new DesiredCapabilities ()

Capabilities.setCapability (CapabilityType.BROWSER_NAME, "")

Capabilities.setCapability ("platformName", "Android")

Capabilities.setCapability ("deviceName", "Android Emulator")

Capabilities.setCapability ("platformVersion", "5.1.1")

Capabilities.setCapability ("appPackage", "com.example.android.contactmanager")

Capabilities.setCapability ("appActivity", ".ContactManager")

AndroidDriver driver = new AndroidDriver (new URL ("http://127.0.0.1:4723/wd/hub"), capabilities))

WebElement el = driver.findElementByAndroidUIAutomator ("text (\" Add Contact\ ")")

El.click ()

List textFieldsList = driver.findElementsByClassName ("android.widget.EditText")

TextFieldsList.get (0) .sendKeys ("Some Name")

TextFieldsList.get (2) sendKeys ("Some@example.com")

Driver.swipe (100,500,100,100,2)

Driver.findElementByAndroidUIAutomator ("text (\" Save\ ")") .click ()

Driver.quit ()

}

}

Some adb commands

Transfer the file to the device: adb push D:\ xxx\ ContactManager.apk / data

Start shell: adb shell

Adb remount

The above is about the content of this article on "how Appium tests ContactManager.apk". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.

Tags: Content tests articles knowledge articles code values commands most of them that is documents more steps knowledge points industry equipment information channels channels help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia MariaDB Huawei Microsoft Shulou Information