cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bruisingfour
New Member

Click link on webpage by text

I am running into an issue where links change position on the page depending on how many devices are listed so selecting by UI element doesn't work as it won't be in the same row each time, when attempting to set it up with other selectors it doesn't appear that "name" or "text" is an option.  

 

How can I get this to identify the text of the link and select by that?

 

bruisingfour_0-1638374648408.png

 

 

bruisingfour_1-1638374676432.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Henrik_M
Super User
Super User

  1. Click the toggle at the bottom of the selector builder so it's gray.
  2. Write a:contains("UCMobile") as selector (or whatever you want the link to contain.
  3. Update.

View solution in original post

8 REPLIES 8
MichaelAnnis
Resident Rockstar
Resident Rockstar

I don't know about that, but there is a move mouse to text on screen (OCR) action.  It will OCR the active window and move the mouse to the text you want; if it works.

Michael531
New Member

One workaround could be to loop through all elements with the given class/id and use Get details of a UI element to get "Own text". When it matches the value you are looking for you click the link.

 

Like section[Class="top-bar-section"] a[Class="main-level"]:eq(%LoopIndex%)

 

Use a danish version of the program but i guess you can see what i mean? 🙂

Michael531_0-1638380364933.png

 

bruisingfour
New Member

I like the idea of the OCR, but it doesn't seem to be working. 

 

As far as looping through the page to find the link, I don't mind this approach, but can't follow this well enough with the current screenshot provided in Danish. Can someone help with this approach in English?

I have the same issue. What I use is the move mouse to text via OCR. It helps to use the setting to look in subregion of foreground window.

This sounds very basic but I got a dry erase marker and put 2 dots on my screen in the area I know the text should appear. Then I go back to PAD. Open "move mouse" and move my cursor to the dots. I write down the X and Y points for each dot. Then I cancel out of "move mouse" because it was just to notate the points. I go back to my OCR box and fill the points in for the subregion. Also, increase the tolerance to 2 or 3.

Li_Xianhua
New Member

I see your UI element is: td:eq(5) > a[id=Row2Col2] , the up level tag <tr>'Row2' you haven't select.

To use the method provide by @Michael531, depends on the webpage's structure, the number in the html structure need to replace to %LoopIndex%,

could be like this:

        td:eq(%loopIndex%) > a

or     td:eq(5) > a[id=Row%loopIndex%Col2]

or     tr[id=Row%loopIndex%] > td:eq5 > a

you could locate the element on the webpage's structure by right click on the element, select "Inspect".

 

for the structure: 

if a html is like below:

<tr>

   <td>1

        <td>2</td>

        <td>3</td>

   </td>

   <td>4</td>

<tr>

you could locate the td with:

1st td: tr > td:eq(0)

2nd td: tr > td > td:eq(0)

3nd td tr > td > td:eq(1)

4th td tr > td:eq(1)

Highboy
Skilled Sharer
Skilled Sharer

Could you please open the webpage, and press ctrl+shift+i 
Then click on the "select element in page to inspect" (marked by the red arrow)  and click on the UI you want.
Take a screen shot and post it here.

 

There are many times where PAD sucks at getting all the good stuff you can use to identify a UI correctly.

Highboy_0-1638529275410.png

 

Henrik_M
Super User
Super User

  1. Click the toggle at the bottom of the selector builder so it's gray.
  2. Write a:contains("UCMobile") as selector (or whatever you want the link to contain.
  3. Update.

View solution in original post

This worked perfectly and is an extremely easy update requiring no additional code added into the script!

 

Why doesn't Microsoft make this information more readily available?!

 

Thank you Henrik_M!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Users online (1,608)