• 关于测试开发的思考 at July 03, 2019
    Author only
    • 作业五

  • #阿维的作业

    weather: rain
    title: 杭州线下第一期_Yaml作业
    room:
    number: 309
    place: "浙江\n杭州\n沈塘桥\n中国电信"
    wifi: [xiaomi_0E09, '12345678']
    smoking: false
    peoples:
    - Susan
    - Sully
    - Smile
    - Ruby
    - SusYour-Namean
    food: null
  • # This sample code uses the Appium python client
    # pip install Appium-Python-Client
    # Then you can paste this into a file and simply run with Python

    from appium import webdriver

    caps = {}
    caps["platformName"] = "android"
    caps["deviceName"] = "demo"
    caps["appPackage"] = "io.appium.android.apis"
    caps["appActivity"] = ".ApiDemos"
    caps["automationName"] = "UiAutomator2"
    caps["newCommandTimeout"] = "600"

    driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
    print(driver.session_id)
    el1 = driver.find_element_by_accessibility_id("App")
    el1.click()

    driver.quit()

    14f43ef3-c2eb-4466-a35a-8b16bcc6c6f5

  • import io.appium.java_client.MobileElement;
    import io.appium.java_client.android.AndroidDriver;
    import org.junit.After;
    import org.junit.Before;
    import org.junit.Test;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.util.concurrent.TimeUnit;

    import org.openqa.selenium.remote.DesiredCapabilities;

    public class XueqiuDemo {

    private AndroidDriver driver;

    @Before
    public void setUp() throws MalformedURLException {
    DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
    desiredCapabilities.setCapability("platformName", "android");
    desiredCapabilities.setCapability("deviceName", "demo");
    desiredCapabilities.setCapability("appPackage", "com.xueqiu.android");
    desiredCapabilities.setCapability("appActivity", ".view.WelcomeActivityAlias");

    URL remoteUrl = new URL("http://localhost:4723/wd/hub");

    driver = new AndroidDriver(remoteUrl, desiredCapabilities);
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    }

    @Test
    public void sampleTest() {
    MobileElement el1 = (MobileElement) driver.findElementById("com.xueqiu.android:id/agree");
    el1.click();
    MobileElement el2 = (MobileElement) driver.findElementById("com.xueqiu.android:id/user_profile_icon");
    el2.click();
    MobileElement el3 = (MobileElement) driver.findElementById("com.xueqiu.android:id/tv_login");
    el3.click();
    MobileElement el4 = (MobileElement) driver.findElementById("com.xueqiu.android:id/tv_login_by_phone_or_others");
    el4.click();
    MobileElement el5 = (MobileElement) driver.findElementById("com.xueqiu.android:id/tv_login_with_account");
    el5.click();
    MobileElement el6 = (MobileElement) driver.findElementById("com.xueqiu.android:id/login_account");
    el6.sendKeys("15068862719");
    MobileElement el7 = (MobileElement) driver.findElementById("com.xueqiu.android:id/login_password");
    el7.sendKeys("123456");
    MobileElement el8 = (MobileElement) driver.findElementById("com.xueqiu.android:id/button_next");
    el8.click();
    }

    @After
    public void tearDown() {
    driver.quit();
    }
    }
  • 感觉写的有点乱,是不是太激动了😂

  • 计费系统也是…

爱我所爱 行我所行