zoukankan      html  css  js  c++  java
  • 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);
      }
      });
      })

    });

      

  • 相关阅读:
    堆表、AO表 行存列存
    PostgreSQL/PPAS CPU使用率高的排查及解决办法【转】
    GP 锁表查询
    gp 日常使用脚本
    常用gp_toolkit监控语句
    DG 参数详解
    Flask 中路由系统
    实例化Flask的参数 及 对app的配置
    Flask 中内置的 Session
    Flask中request参数
  • 原文地址:https://www.cnblogs.com/saryli/p/8384305.html
Copyright © 2011-2022 走看看