![](/img/trans.png)
[英]Not able to click a button which is not enabled using Appium Java for Android app
[英]Not able to click on button in android native app using appium 1.6.4
我無法單擊“注銷”按鈕。 我使用TouchAction類使用了所有可能的方法,例如定位器,UISelector和Tab,但是沒有成功。 即使getlocation()。getX()方法也無法單擊元素,也不會引發任何異常。
試試下面的代碼:
driver.findElement(By.id("LOGOUT")).click();
// Update your xpath accordingly and use following code
@FindBy(xpath="//android.widget.buttonView[@text='logout']")
private WebElement logoutbutton;
if(logoutbutton.isEnabled())
{
logoutbutton.click();
}
// If your app is having id for this element then use following , update logout with id available in your app
@FindBy(id="logout")
private WebElement logoutbutton;
if(logoutbutton.isEnabled())
{
logoutbutton.click();
}
這樣聲明元素,
@AndroidFindBy(id = "com.care.android.careview:id/logout")
public MobileElement logoutButton;
用法是:
logoutButton.click();
這應該工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.