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);
  }
  });
  })

});

  

Iterating elements using NightWatchJS的更多相关文章

  1. js Form.elements[i]的使用实例

    function pdf(){    //一个html里面可能存在多个form,所以document.form[0]指的是第一个form,document.form[1]返回就是第二个form,如果没 ...

  2. View and Data API Tips: Hide elements in viewer completely

    By Daniel Du With View and Data API, you can hide some elements in viewer by calling "viewer.hi ...

  3. [LeetCode] Minimum Moves to Equal Array Elements II 最少移动次数使数组元素相等之二

    Given a non-empty integer array, find the minimum number of moves required to make all array element ...

  4. [LeetCode] Minimum Moves to Equal Array Elements 最少移动次数使数组元素相等

    Given a non-empty integer array of size n, find the minimum number of moves required to make all arr ...

  5. [LeetCode] Top K Frequent Elements 前K个高频元素

    Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2 ...

  6. [LeetCode] Remove Linked List Elements 移除链表元素

    Remove all elements from a linked list of integers that have value val. Example Given: 1 --> 2 -- ...

  7. Chrome 开发工具之Elements

    友情提示:全文图片高能,如使用手机阅读,请确保在wifi情况下或者流量充足.图片有点渣,也算辛苦做出来的,请别嫌弃- Elements面板主要展示当前页面的组织结构,在如今的应用程序中,HTML页面初 ...

  8. T-SQL Recipes之Separating elements

    Separating elements Separating elements is a classic T-SQL challenge. It involves a table called Arr ...

  9. POJ2167Irrelevant Elements[唯一分解定理 组合数 杨辉三角]

    Irrelevant Elements Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 2407   Accepted: 59 ...

随机推荐

  1. Appium+python自动化8-Appium Python API【转载】

    前言: Appium Python API全集,不知道哪个大神整理的,这里贴出来分享给大家. 1.contexts contexts(self): Returns the contexts withi ...

  2. VirtualBox安装部署的Ubuntu16.04的步骤

    1.下载ubuntu16.04镜像 http://cn.ubuntu.com/download/ 以及虚拟机软件VirtualBox https://www.virtualbox.org/wiki/D ...

  3. [BZOJ1072][SCOI2007]排列perm 状压dp

    1072: [SCOI2007]排列perm Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 2488  Solved: 1546[Submit][St ...

  4. Mex函数与C++数据矩阵交互方法

    #include "mex.h" #include <iostream> #include <windows.h> #include "math. ...

  5. DB Link

    oracle中DB Link select * from TB_APP_HEADER@SSDPPORTAL

  6. Ubuntu 16.04/CentOS 6.9安装Apache压力(并发)测试工具ab

    说明: ab工具已经在Apache中包含,如果不想安装Apache,那么可以使用下面方法单独安装. 安装: Ubuntu: sudo apt-get install apache2-utils Cen ...

  7. 教程:基于Spring快速开发电子邮件发送功能

    在Spring框架的spring-context-support.jar中有对电子邮件发送功能的封装: 基于Spring开发简单省事,而且更稳定.需要mail.jar包支持 @Component pu ...

  8. Delphi CRC16校验算法实现(转)

    循环冗余码校验英文名称为Cyclical Redundancy Check,简称CRC.它是利用除法及余数的原理来作错误侦测(Error Detecting)的.实际应用时,发送装置计算出CRC值并随 ...

  9. Understanding Memory Technology Devices in Embedded Linux

    转: NAND Chip Drivers NAND technology users such as USB pen drives, DOMs, Compact Flash memory, and S ...

  10. vertex buffer 数据结构 如何读vb的memory pool

    vertex attribute (declaration)    vertex stream (memory pool) 这两部分 通过attribute 里面对memory的描述把两部分 vbo ...