【问题标题】:How to access child element via wdio如何通过 wdio 访问子元素
【发布时间】:2019-11-23 03:33:07
【问题描述】:

以下代码用于查找父级。访问孩子需要传递什么而不是“..”?

const parent = paragraph.$('..')

console.log(parent.getTagName()) // 输出:“body”

【问题讨论】:

    标签: webdriver-io


    【解决方案1】:

    你知道你在寻找哪些元素吗?检查这些示例:

    paragraph.$$('//*')      // find all childs
    paragraph.$('a')         // find first child link
    paragraph.$('*=Submit')  // find first child element which contains 'Submit'
    

    您可以根据需要使用任何定位器策略 - CSSXPathTagNametext。检查documentation

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-23
      • 2023-03-07
      • 2019-05-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多