代码之家  ›  专栏  ›  技术社区  ›  Lieutenant Dan

在nightwatch.js中使用文档

  •  0
  • Lieutenant Dan  · 技术社区  · 8 年前

    我想用:

          var newGroups = document.getElementsByTagName("a.group-link")
          var id = newGroups[0].getAttribute('id')
          .click(id)
    

    在nightwatch.js中-但任何时候我试图使用' document

     ✖ ReferenceError: document is not defined
    
    1 回复  |  直到 8 年前
        1
  •  2
  •   QualiT    8 年前

    .execute( function() {  
        var newGroups = document.getElementsByTagName("a.group-link")
        var id = newGroups[0].getAttribute('id')
        .click(id)
    })