使用Appium安装apk时,AutoCompleteTextView不显示任何下拉项

时间:2016-07-01 12:24:06

标签: android automation appium autocompletetextview

我是Appium移动自动化工具的新手。

服务器版本: 1.4.16.1

操作系统:Windows 7

我在做什么:实际上Appium在我的Android设备上安装apk的方式改变了App的行为。例如:AutoCompletetextview在通过Appium安装apk时没有显示建议,否则在手动安装App时它会表现完美。

手动安装App时,“AutoCompletetextview”效果非常好。你可以看到下面的图片

Automated appium

但是当App通过Appium安装/如果我设置这些参数

  

capabilities.setCapability( “NORESET”, “真”);

     

capabilities.setCapability( “fullReset”, “假”);

AutoCompletetextview不会显示任何建议。

Maually-pic

我想要实现的目标:我想从Autocompletetextview中选择建议。

找到下面的代码

package appium_project_two;

import io.appium.java_client.android.AndroidDriver;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;

public class StoreCreditBill {

    // create global array list containing barcodes
    static String strBarcodeList[] = { "1" };

    // create global variable
    private static AndroidDriver driver;

    public static void main(String[] args) throws MalformedURLException, InterruptedException {

        // Create object of DesiredCapabilities class

        DesiredCapabilities capabilities = new DesiredCapabilities();

        // to avoid installing app again and again
        capabilities.setCapability("noReset", "true");

        // to avoid installing app again and again
        capabilities.setCapability("fullReset", "false");

        // Optional

        capabilities.setCapability(CapabilityType.BROWSER_NAME, "");

        // Specify the device name (any name)

        capabilities.setCapability("deviceName", "Bewo Genie POS");

        // Platform version

        capabilities.setCapability("platformVersion", "4.4.2");

        // platform name

        capabilities.setCapability("platformName", "Android");

        // specify the application package that we copied from appium

        capabilities.setCapability("appPackage", "com.bewo.retails");

        // specify the Bewo Application activity that you want to access

        capabilities.setCapability("appActivity", ".activities.HomeScreen");

        // Start android driver I used 4727 port by default it will be 4723

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

        // passing the barcode 
        driver.findElement(By.id("com.bewo.retails:id/txtAutoSearch_Billing")).sendKeys(strBarcodeList[0] + "\n");

        // waiting for some time
        driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

        // passing customer name
        driver.findElement(By.id("com.bewo.retails:id/txtAutoCPhone_Billing")).sendKeys("Saurabh");

        //waiting for some time
        driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);

        // trying to click on the exact place where the AutoTextview List will populate
        driver.findElement(By.id("com.bewo.retails:id/chkHomeDelivery")).click();

        // waiting again for sometime
        driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);

        // pressing the Quickpay Button
        driver.findElement(By.id("com.bewo.retails:id/btnQuickPay_Billing")).click();

        // pressing the Quick Return Button
//      driver.findElement(By.id("com.bewo.retails:id/btnQuickReturn_Billing")).click();


        driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);

        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            System.out.println("got interrupted!");
        }
        // close the application
        driver.quit();

    }

}

0 个答案:

没有答案