【问题标题】:Unable to click on a button using Content-desc in appium无法在 appium 中使用 Content-desc 单击按钮
【发布时间】:2020-03-26 17:47:04
【问题描述】:

我是 Appium 测试新手。我能够设置一切并运行测试。我使用 UiAutomatorViewer 来访问一些按钮,现在我需要单击一个按钮,但我刚刚得到了 Cont-desc。我尝试了以下 XPath,但最终出现错误。任何帮助都会很好。

  1. @FindBy(xpath = "//*[@contentDescription='SIGN IN   log in ']")
  2. driver.FindElement(By.XPath("//android.widget.Button[@content-desc='SIGN IN   log in ']")).Click();
  3. driver.FindElement(By.Name('SIGN IN   log in ')).Click();
  4. driver.FindElement(By.Xpath(//*[@Class='android.view.View' OR @content-desc='SIGN IN    log in '])).Click();

提前谢谢 :)

【问题讨论】:

  • 点击上一层怎么办?

标签: android appium android-uiautomator


【解决方案1】:

使用以下xpath

driver.FindElement(By.XPath("//*[contains(@content-desc, 'SIGN')]")).Click();

【讨论】:

    猜你喜欢
    • 2015-01-09
    • 2017-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-20
    • 2020-02-19
    • 1970-01-01
    • 2017-02-28
    相关资源
    最近更新 更多