Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Appium test ContactManager.apk

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report