appium--master-Slave control execution

Source: Internet
Author: User

1. Client (Eclipse) machine A, service side (Appium, genymotion) Machine B

2. Set Appium,server address to 192.168.17.123, restart Appium

3. In client machine a browser, type: Http://192.168.17.123:4723/wd/hub,

Description the configuration was successful.

Java code:

where driver= new Androiddriver<webelement> ("http://192.168.17.123/4723/wd/hub"), capabilities) ;

Capabilities.setcapability ("App", "f:\\contactmanager.apk"); f:\\contactmanager.apk the path to the server apk

 Public classAppiumtest { PublicAndroiddriver<webelement>driver; @BeforeClass Public voidStarttest ()throwsmalformedurlexception{//file classpathroot= New file (System.getproperty ("User.dir")); //file appdir= New file (Classpathroot, "Res/app"); //file app= New file (Appdir, "contactmanager.apk");Desiredcapabilities capabilities=Newdesiredcapabilities (); Capabilities.setcapability ("Automationname", "Appium"); Capabilities.setcapability ("PlatformName", "Android"); Capabilities.setcapability ("DeviceName", "Android Emulator"); Capabilities.setcapability ("Platformversion", "4.4.2"); //depending on the app, Capabilities,appium will install the app to the device before launching the test.Capabilities.setcapability ("App", "f:\\contactmanager.apk"); //Set the capability of the Android app's package name to tell Appium which app you want to run. Capabilities.setcapability ("Apppackage", "Com.example.android.contactmanager"); Capabilities.setcapability ("Appactivity", ". Contactmanager "); Driver=NewAndroiddriver<webelement> (NewURL ("Http://192.168.17.123:4723/wd/hub"), capabilities); } @Test Public voidaddcontact () {//webelement el= driver.findelement (By.xpath (".//*[@text = ' Add contact ']);Webelement el = Driver.findelementbyandroiduiautomator ("New Uiselector (). Text (\" Add contact\ ")");      El.click (); List<WebElement> textfieldslist= driver.findelementsbyclassname ("Android.widget.EditText"); Textfieldslist.get (0). SendKeys ("Some Name")); Textfieldslist.get (2). SendKeys ("[Email protected]"); Driver.swipe (100, 500, 100, 100, 2); Driver.findelementbyxpath (".//*[@text = ' Save ']"). Click (); } @AfterClass Public voidAfterclass () {driver.quit (); }   }

appium--master-Slave control execution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.