【问题标题】:Appium: Element is not interactable error is getting displayed while tapping on the checkboxAppium:点击复选框时显示元素不可交互错误
【发布时间】:2019-09-27 23:15:46
【问题描述】:
  1. 试过了:xpath= //*[@id="mktoCheckbox_52362_0"],

控制台错误:元素不可交互。

  1. 试过了:Xpath= //[@id="mktoForm_2768"]/div[10]/div[1]/div[2]/div[2]/label,

控制台错误:元素不可交互。

  1. 试过了:xpath= //*[text()='I agree to the '],

单击“许可协议”链接并在其他选项卡中打开 pdf 文件。

应用了以上所有xpath,但仍然没有结果。请为此问题提供一些解决方案。

【问题讨论】:

标签: mobile appium emulation


【解决方案1】:

假设您正在尝试自动化此页面:https://info.couchbase.com/couchbase_server_mobile.html

  • 如果您想在新选项卡中打开许可协议 - 相关的 XPath 将是

    //a[text()='License Agreement']
    

  • 如果你想勾选与许可协议相关的复选框,你需要这个:

    //input[@name='termsandConditions']
    

在这两种情况下,最好使用Explicit Wait 来确保元素在尝试通过ExpectedConditions.elementToBeClickable() 函数与其交互之前是可点击的

如果您正在研究移动自动化,可以考虑使用提供Copy Unique XPath featureAppium Studio,它可以让您在定义元素定位器时更轻松

【讨论】:

  • 尝试使用 //input[@name='termsandConditions'] 时。出现错误:org.openqa.selenium.ElementNotVisibleException:元素不可交互
  • 应用时---------------------------------------- -------------------------------- WebDriverWait wait = new WebDriverWait(driver, 10); WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@name='termsandConditions']"))); element.click();--------控制台错误:org.openqa.selenium.TimeoutException:预期条件失败:等待元素可点击:通过。 xpath: //input[@name='termsandConditions'](以 500 MILLISECONDS 间隔尝试 10 秒)
猜你喜欢
  • 2019-09-22
  • 1970-01-01
  • 2021-07-08
  • 2022-01-15
  • 1970-01-01
  • 2014-10-29
  • 2021-09-22
  • 1970-01-01
  • 2021-10-28
相关资源
最近更新 更多