我是新手,但对C#有很好的体验。对于有问题的屏幕,有一个编辑字段“请输入您的appcode”。Appium桌面可以轻松地使用'id‘来识别元素。识别后,我尝试单击,并必须为appcode输入一个值。令人惊讶的是,在java中,这个元素很容易用'Id‘来标识。

我尝试过'FindElementById','FindElementByAccessibilityId‘和'FindElementByXPath’,但它们都不起作用。我还尝试了显式等待。
IWebElement Appcode = driver.FindElementByAccessibilityId("com.abc.dbanking:id/appcode_tie");或
IWebElement Appcode = driver.FindElementById("com.abc.dbanking:id/appcode_tie");或
IWebElement Appcode = driver.FindElementByXPath("//android.widget.EditText(@resource-id = 'com.abc.dbanking:id/appcode_tie'));或
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(45));
IWebElement Appcode = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(By.Id("com.abc.dbanking:id/appcode_tie")));但是每次我得到'NoSuchElementException‘并且驱动程序不能在页面上定位这个元素。
发布于 2019-07-10 03:02:11
尝试driver.FindElementByXPath("//*contains(@resource-id,element = driver.FindElementById("appcode_tie");或者IWebElement element =driver.FindElementById 'appcode_tie')");
https://stackoverflow.com/questions/56868067
复制相似问题