Java Exercise-002

Source: Internet
Author: User

Package Com.syswin.first;

/**

* @author Yufeifei

* @version November 14, 2017 9:12:08

* Class Description: First Startup class

*/

Import Io.appium.java_client.android.AndroidDriver;

Import Java.io.File;

Import java.net.MalformedURLException;

Import Java.net.URL;

Import org.openqa.selenium.remote.DesiredCapabilities;

Import Org.testng.annotations.AfterSuite;

Import Org.testng.annotations.BeforeSuite;

Import Org.testng.annotations.Test;


Import Com.appium.test.TestngListener;


public class Appiumtestcase {

Private Androiddriver driver;

Public Androiddriver Getdriver () {

return driver;

}

public void Setdriver (Androiddriver driver) {

This.driver = driver;

}

@BeforeSuite

public void Beforesuite () throws malformedurlexception{

Set up Appium

File Classpathroot = new file (System.getproperty ("User.dir"));//Get current path

File Appdir = new file (classpathroot, "apk");//Get the path to the APK folder

File app = new file (appdir, "toon-beijing-test.apk");//Get the app you want to test

Desiredcapabilities capabilities = new Desiredcapabilities ();//Create Desiredcapabilities Object

Capabilities.setcapability ("PlatformName", "Android");//Mobile operating system

Capabilities.setcapability ("DeviceName", "test");//real machine name, Android does not work at present

Capabilities.setcapability ("platformversion", 4.3);//android system version

Capabilities.setcapability ("App", App.getabsolutepath ());//install app on phone

Capabilities.setcapability ("Apppackage", "Com.systoon.beijingtoon");//package

Capabilities.setcapability ("Appactivity", "com.systoon.toon.user.login.view.WelcomeActivity");

Capabilities.setcapability ("Unicodekeyboard", "Ture");//Input Chinese

Capabilities.setcapability ("Resetkeyboard", "Ture");

Driver = new Androiddriver<> (New URL ("Http://127.0.0.1:4723/wd/hub"), capabilities);

}

@AfterSuite

public void Aftersuite () {

Driver.quit ();

}

@Test

public void Testmoment () throws exception{

Thread.Sleep (6000);

Driver.findelementbyid ("Com.systoon.beijingtoon:id/main_tab_icon"). Click (); Message tab

Driver.findelementbyid ("Com.systoon.beijingtoon:id/main_tab_icon"). Click (); Message tab

Driver.findelementbyid ("Com.systoon.beijingtoon:id/tv_change_to_trend"). Click (); Dynamic

Thread.Sleep (2000);

Driver.findelementbyid ("Com.systoon.beijingtoon:id/trends_home_page_float_button"). Click (); Release

Driver.findelementbyid ("Com.systoon.beijingtoon:id/content_richedit_input"). SendKeys ("The first dynamic released");

Thread.Sleep (2000);

Driver.findelementbyid ("com.systoon.beijingtoon:id/content_item_picture_selected"). Click (); Add a photo

Thread.Sleep (2000);

Driver.findelementbyid ("Com.systoon.beijingtoon:id/trends_view_select_sort_item_btn"). Click (); Shooting

Thread.Sleep (2000);

Driver.findelementbyid ("Com.systoon.beijingtoon:id/trends_video_rec_in_iv"). Click (); Shooting

Thread.Sleep (2000);

Driver.findelementbyid ("Com.systoon.beijingtoon:id/trend_video_finish_rl"). Click (); Selected

Driver.findelementbyid ("Com.systoon.beijingtoon:id/rich_normal_location_layout"). Click (); Your location

Thread.Sleep (2000);

Driver.findelementbyid ("Com.systoon.beijingtoon:id/tv_item_plugin_map_listview_addr"). Click (); Hainan Real Estate

Thread.Sleep (2000);

Driver.findelementbyid ("com.systoon.beijingtoon:id/title_right_bt_id"). Click (); Are you sure

Driver.findelementbyid ("com.systoon.beijingtoon:id/title_right_bt_id"). Click (); Send

}


}


Java Exercise-002

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.