A variety of problems testing Android Webview using Appium

I have a hybrid application, which is basically a web view. Here is the basic test code:

  @BeforeClass
  public static void setupAppium() throws MalformedURLException {
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("appium-version", "1.5.3");
    capabilities.setCapability("platformName", "Android");
    capabilities.setCapability("platformVersion", "6.0");
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "AppiumTesterDevice");
    capabilities.setCapability("app", "/work/builds/unify/app/build/outputs/apk/app-debug.apk");
    capabilities.setCapability("appPackage", "com.company.unify");
    capabilities.setCapability("appActivity", "AdministerActivity");
    driver = new AndroidDriver<>(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
  }

  @Test
  public void CompanyUrlTest() {
    driver.findElement(By.xpath("//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.EditText[1]")).clear();
    driver.findElement(By.xpath("//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.EditText[1]")).sendKeys(companyserverUrl);
    driver.findElement(By.xpath("//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[3]/android.widget.Button[2]")).click();
  }

  @Test
  public void SimpleTest() {
    driver.context("WEBVIEW_com.company.unify");
    WebDriverWait wait = new WebDriverWait(driver,20);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(".localPickerList")));
    driver.findElementByCssSelector(".localePickerList").click();
    driver.findElementByCssSelector(".SPANISH_PR").click();
  }

The first test works fine because it only works in a regular Android application, without web browsing. So this is just changing the url in the text box and clicking a button to bring us to that url in the webview.

There are problems in the second test, and the problems change depending on the version of android and the version of chrome. I made tons of search engine and I can only conclude that there is an endless series of errors with appium / selendroid / chromedriver.

Chromedriver https://sites.google.com/a/chromium.org/chromedriver/downloads. appium , . Android 6.0 ChromeDriver:

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Can't stop process; it not currently running (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 224 milliseconds
Build info: version: 'unknown', revision: '1969d75', time: '2016-10-18 09:43:45 -0700'
System info: host: 'company-me-m', ip: '192.168.1.154', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.4', java.version: '1.8.0_45'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{app=/work/builds/unify/app/build/outputs/apk/app-debug.apk, appPackage=com.company.unify, networkConnectionEnabled=true, warnings={}, databaseEnabled=false, deviceName=emulator-5554, platform=LINUX, deviceUDID=emulator-5554, appActivity=AdministerActivity, desired={app=/work/builds/unify/app/build/outputs/apk/app-debug.apk, appPackage=com.comany.unify, appActivity=AdministerActivity, appium-version=1.5.3, platformVersion=6.0, automationName=Appium, platformName=Android, deviceName=AppiumTesterDevice}, appium-version=1.5.3, platformVersion=6.0, webStorageEnabled=false, locationContextEnabled=false, automationName=Appium, takesScreenshot=true, javascriptEnabled=true, platformName=Android}]
Session ID: bc7100bd-2498-47d2-b0f2-3b29602c8e0d

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:635)
    at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
    at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
    at io.appium.java_client.AppiumDriver.context(AppiumDriver.java:557)
    at com.comapny.UnifyAppiumJunit.BasicTest.SimpleTest(BasicTest.java:57)

Chromedriver, appium, (, , , chromedriver , ). :

Jan 27, 2017 3:02:39 PM org.openqa.selenium.support.ui.ExpectedConditions findElement
WARNING: WebDriverException thrown by findElement(By.cssSelector: .localPickerList)
org.openqa.selenium.NoSuchSessionException: no such session

, - . -, , . Wait, , ? ?

, Android 5.1.1, :

WebDriverException thrown by findElement org.openqa.selenium.WebDriverException: unknown error: Maximum call stack size exceeded

? Google.

0
1

UIautomator -. webView.

Android SDK .

WebView UIAutomator Android 6.0+. , script Android 6.0+, script Android 6.0.

webView Android 6.0+, UIAutomator.

.

+2

Source: https://habr.com/ru/post/1664671/


All Articles