Current time: 10-23-2020, 07:53 AM Hello There, Guest! (LoginRegister)

Post Reply 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to select elements with class names
11-10-2015, 10:14 AM (This post was last modified: 11-10-2015 10:15 AM by rviscomi.)
Post: #2
RE: How to select elements with class names
The input to clickAndWait is attribute=value. In your HTML code, there are only two attributes: class and data-ng-click. If there are no other elements with that combination of class names, you could target the Select All element with this pair:

clickAndWait class="ds-app-pointer-plain option-vertically-center option-text ng-binding"

Although I'm not sure if this will work because of the quotes. Omitting them might not work either because of the spaces.

So you can try the second attribute, data-ng-click:

clickAndWait data-ng-click=selectAll()

But again, this might not work because of the parentheses. You'll have to try it to be sure.

If all else fails, you could use querySelector like you attempted. However, clickAndWait only takes an attribute=value pair. So you'll need a different command. execAndWait will take an arbitrary JS statement and execute it. Here's something that might be more robust:

execAndWait document.querySelector('a[data-ng-click="selectAll()"]').click()

All of this would be made so much easier if the element you want to click on had a concise ID. For example if it looked like <a id="select-all" ...>Select All</a> you could simply write:

clickAndWait id=select-all
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: How to select elements with class names - rviscomi - 11-10-2015 10:14 AM

Forum Jump:

User(s) browsing this thread: 1 Guest(s)