Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. client.elements('xpath', ".//a[@class='abcd')]", function (allButtons){
  2. console.log('Element value is '+element)
  3. allButtons.value.forEach(function (element) {
  4. this.elementIdClick(element, function(res){});
  5. }
  6. }
  7.  
  8. TypeError: Object #<Object> has no method 'elementIdClick'
  9.  
  10. client.elements('xpath', ".//a[@class='abcd')]", function (allButtons){
  11.  
  12. allButtons.value.forEach(function (element) {
  13. console.log('Element value is '+element)
  14. this.elementIdClick(this.elementIdAttribute(allButtons.value[element].ELEMENT, 'id'), function(res){});
  15.  
  16. Element value is [object Object]
  17. TypeError: Cannot read property 'ELEMENT' of undefined
  18.  
  19. function iter(elems) {
  20. elems.value.forEach(function(element) {
  21. client.elementIdClick(element.ELEMENT)
  22. })
  23. };
  24. client.elements('css selector', 'button.my-button.to-iterate', iter);
  25.  
  26. client.elements('xpath', ".//a[@class='abcd')]", function (allButtons){
  27.  
  28. allButtons.value.forEach(function (index) {
  29. console.log('Element value is '+index.ELEMENT)
  30. client.elementIdClick(index.ELEMENT);}})
  31.  
  32. // Executing a function in the application context.
  33. client.execute(function () {
  34.  
  35. // Get elements by CSS selector.
  36. var elements = document.querySelectorAll('.elements');
  37.  
  38. // Iterate over them.
  39. [].forEach.call(elements, function (element) {
  40.  
  41. // Manipulate each element.
  42. element.click();
  43. });
  44. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement