Веб-элемент не может найти элемент в Java затмения с тестом приложения Android Appium
Это мой код. на самом деле я запустил приложение для Android с Appium, используя Eclipse. здесь приложение запускается, но не находит ни одного элемента и показывает ошибку в консоли. ошибка " Исключение в потоке" main "java.lang.NullPointerException ".
package amazon;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
//import junit.framework.Assert;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
//import org.junit.Assert;
//import org.junit.Test;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
public class StartApplication {
private static AndroidDriver driver;
public static void main(String[] args) throws MalformedURLException, InterruptedException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("deviceName", "a71ce4a7");
capabilities.setCapability("platformVersion", "5.0.2");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("appPackage", "com.hypersoft.vwallet");
//capabilities.setCapability("appActivity", "com.hypersoft.vwallet.ui.activity.HomeActivityNew_");
capabilities.setCapability("appActivity", "com.hypersoft.vwallet.ui.activity.SignInActivity_");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
//Thread.sleep(10000);
System.out.println("App launched");
//Thread.sleep(10000);
driver.findElementById("com.hypersoft.vwallet:id/tvGetHelp").click();
driver.findElement(By.id("com.hypersoft.vwallet:id/etMailAddress")).sendKeys("test@gmail.com");
//driver.findElementByClassName("android.widget.EditText").sendKeys("test@gmail.com");;
System.out.println("test");
driver.findElement(By.id("com.hypersoft.vwallet:id/btnAgree")).click();
driver.findElement(By.id("com.hypersoft.vwallet:id/etMailAddress")).sendKeys("test321@gmail.com");
driver.findElement(By.id("com.hypersoft.vwallet:id/etPassword")).sendKeys("test4321");
driver.findElement(By.id("com.hypersoft.vwallet:id/etPasswordRe")).sendKeys("test4321");
driver.findElement(By.id("com.hypersoft.vwallet:id/etLastName")).sendKeys("Patel");
driver.findElement(By.id("com.hypersoft.vwallet:id/etFirstName")).sendKeys("Niravpp");
driver.hideKeyboard();
driver.findElement(By.id("com.hypersoft.vwallet:id/btnSignUp")).click();
driver.findElement(By.className("android.widget.ImageButton")).click();
driver.findElementByName("Logout").click();
driver.findElement(By.id("android:id/button1")).click();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.findElement(By.id("com.hypersoft.vwallet:id/etMailAddress")).sendKeys("test321@gmail.com");
driver.findElement(By.id("com.hypersoft.vwallet:id/etPassword")).sendKeys("test4321");
driver.findElement(By.id("com.hypersoft.vwallet:id/btnSignIn")).click();
WebElement element = driver.findElement(By.name("VCA Wallet"));
String strng = element.getText();
Assert.assertEquals(strng,"VCA Wallet");
if(strng.equals("VCA Wallet"))
{
System.out.printf("pass\n");
} else {
System.out.println("Fail\n");
}
System.out.println(strng);
//driver.swipe(startx, starty, endx, endy, duration);
driver.close();
}
}