Browser Appium:无法按ID和名称在Android chrome浏览器中找到元素,获取;“无效辩论例外”;

Browser Appium:无法按ID和名称在Android chrome浏览器中找到元素,获取;“无效辩论例外”;,browser,selenium-chromedriver,appium,invalid-argument,desiredcapabilities,Browser,Selenium Chromedriver,Appium,Invalid Argument,Desiredcapabilities,我正在使用Appium(v1.15.1)在Android设备上使用Chrome浏览器从“”查找电子邮件密码字段,并且我无法使用方法findElementById(“”)和findElementByName(“”)查找电子邮件和密码字段元素。我试着用XPath找到它,它很有效 这是我的代码: public class Browse extends BaseMobile { public static void main(String[] args) throws Malformed

我正在使用Appium(v1.15.1)在Android设备上使用Chrome浏览器从“”查找电子邮件密码字段,并且我无法使用方法findElementById(“”)和findElementByName(“”)查找电子邮件和密码字段元素。我试着用XPath找到它,它很有效

这是我的代码:

public class Browse extends BaseMobile {

       public static void main(String[] args) throws MalformedURLException {
           AndroidDriver<AndroidElement> driver = capabilities();
           driver.get("http://facebook.com");
           driver.findElementById("m_login_email").sendKeys("prueba@mail.com"); //  not working 
           driver.findElementByName("pass").sendKeys("123456789"); //  not working
           driver.findElementByXPath("//*[@name='login']").click(); 
       }
}
公共类浏览扩展BaseMobile{
publicstaticvoidmain(字符串[]args)引发畸形的DurLexException{
机器人驾驶员


在driver.get(“”;行之后,尝试打印页面源代码,看看它是否正在获取页面源代码。尝试System.out.println(driver.getPagesource());

您还可以共享应用程序日志吗。
public class BaseMobile {

       public static AndroidDriver<AndroidElement> capabilities() throws MalformedURLException {

           AndroidDriver<AndroidElement> androidDriver;
           String serverUrl = "http://127.0.0.1:4723/wd/hub";
           DesiredCapabilities cap = new DesiredCapabilities();
           cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android device");
           cap.setCapability(MobileCapabilityType.BROWSER_NAME, "Chrome");
           androidDriver = new AndroidDriver<AndroidElement>(new URL(serverUrl), cap);
           androidDriver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
          return androidDriver;
       }
}