• Iterating elements using NightWatchJS


    1) used the following strategy to iterate over DOM elements using Nightwatch:

    // Executing a function in the application context.
    client.execute(function () {
    
      // Get elements by CSS selector.
      var elements = document.querySelectorAll('.elements');
    
      // Iterate over them.
      [].forEach.call(elements, function (element) {
    
        // Manipulate each element.
        element.click();
      });
    });
    

      

    2) the number returned by allitems.value[0].ELEMENT will work as the id.

    3) jQuery 定位

    $('#padt_lic_numb > ul > li > label').each(function(){
    
                    $(this).click();
                          
             });
    

    4) nightwatchjs

    client.elements("css selector","#padt_lic_numb > ul > li > label",function(results)
    {
      results.value.forEach(function(index){
      // console.log('Element value is '+index.ELEMENT);
      client.elementIdText(index.ELEMENT,function(result){
      //console.log(result.value);
      if(result.value == plate_number)
      {
        console.log(result.value);
        console.log(plate_number);
        client.elementIdClick(index.ELEMENT);
      }
      });
      })

    });

      

  • 相关阅读:
    android 如何引用jar包
    ExoPlayer + 边缓存边播放
    adb打开系统设置的命令
    android 8.0 适配(总结)
    android 7.0适配(总结)
    android 6.0适配(总结)
    常用adb命令
    nginx 简介
    Marshmallow 的用法
    python 自动生成当前项目的requirements文件
  • 原文地址:https://www.cnblogs.com/saryli/p/8384305.html
Copyright © 2020-2023  润新知