Current time: 10-23-2020, 07:13 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, 09:18 PM (This post was last modified: 11-12-2015 08:59 PM by Vijayram.)
Post: #3
RE: How to select elements with class names
Hi Viscomi,

Thank you very much for the quick reply. I have tried the things that you have mentioned below but no luck. Below are the tried i did...

In my scenario i need to select "Select All" link and click on the done button.
The script for the same is

execAndWait document.querySelector('a[data-ng-click="selectAll()"]').click()
execAndWait class="ds-app-pointer-plain option-vertically-center option-text ng-binding"
execAndWait document.querySelector('a[class="ds-app-pointer-plain option-vertically-center option-text ng-binding"]').click()
execAndWait document.querySelector('a[data-ng-click=selectAll()]').click()

for button id i have the script
clickAndWait id=team-memeber-selection-done

The error i am seeing after the script execute is "Repeat View: Test Data Missing"

How to get out of this error and what is the correct WPT script to click on the Select All
<a class="ds-app-pointer-plain option-vertically-center option-text ng-binding" data-ng-click="selectAll()">Select All</a>

And also i observed some popup in the video but the same is not observed when we executed it manually in the chrome browser. How to handle this type of pop-up issues? Is there any way to clear the browser cache of the the location we are running? Enclosed the scree shot showing the pop up after page loading. The script is as below

1. navigate - Success
2. setValue name'proxyUsername PMChevUser - Success
3. setValue name'proxyPassword Cdk-0109 - Success
4. clickAndWait name'loginSubmit - Success
5. execAndWait document.querySelector('a[href*="prospect"]').click() - Success
6. execAndWait document.querySelector('a[data-ng-click="selectAll()"]').click() - Failed
7. clickAndWait id=team-memeber-selection-done - Not executed.

For 6th script line our code is "<a class="ds-app-pointer-plain option-vertically-center option-text ng-binding" data-ng-click="selectAll()">Select All</a>"

Could you please look into this and update me where i am going in the wrong way...

(11-10-2015 10:14 AM)rviscomi Wrote:  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

Attached File(s) Image(s)
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 - Vijayram - 11-10-2015 09:18 PM

Forum Jump:

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