Choosing the final row and then potentially looping in reverse

After receiving some great assistance here, I have another question. On a screen, there are multiple rows of clickable links with the same name. I need to click on the last row and determine if it's the correct one. If not, I have to backtrack and select the 2nd to last row, then the 3rd to last row, and so on until I find what I'm looking for or run out of rows.

Every row has the same name except for the number after "TaskRow." Is there any way to differentiate them?

Here is an example of a row:

<a href="javascript:void(0)" role="button" dojoattachpoint="subject" dir="ltr" aria-labelledby="taskrowsubjectcom_ibm_bpm_social_widgets_task_list_TaskRow_19" title="Click to work on the task">Request Full Quotes from Supplier: Supplier One</a>

Before this row, there is some code that looks like this:

<div id="dueToday" class="bpm-task-list-category dijitTitlePane" title="" role="group" widgetid="dueToday" aria-label="Due Today (2)" style="display: block;">
...
...
...
...
...
...

... 
...
...
...
...

<a href="javascript:void(0)" role="button" dojoattachpoint="subject" dir="ltr" aria-labelledby="taskrowsubjectcom_ibm_bpm_social_widgets_task_list_TaskRow_1" title="Click to work on the task">Request Full Quotes from Supplier: Supplier One</a>
...
...
 ...
...

Any suggestions would be greatly appreciated!

Thank you, Greg

Answer №1

If you want to achieve this, you can utilize the :last-child selector like so:

a:last-child[aria-labelledby^='taskrowsubject']

After analyzing the more detailed HTML structure, I managed to create the following xpath expression:

(//a[contains(@aria-labelledby, 'TaskRow')])[last()]

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Unusual border effect on three.js webgl transparent png texture

Currently facing an unusual issue with using pngs as textures in three.js. The pngs develop odd borders at the transition between visible and transparent areas. I have tried adjusting the alphatest value, but this sometimes causes the image to disappear ...

Align the camera to be perpendicular with the ground

Ensuring that my fly camera always remains parallel to the ground is crucial to me. Specifically, I need my camera's right vector to always be (1,0,0). To achieve this, I have developed a customized Camera Controller in three.js that simulates unique ...

Adjust puppeteer window dimensions when running in non-headless mode (not viewport)

Is there a way to adjust the browser window size to match the viewport size in Chrome(ium)? When only setting the viewport, the browser can look awkward if it is not running headfully and I want to visually monitor what's happening within the browser ...

I require assistance in integrating this code into a jQuery function within a .js file

In a previous discussion, Irina mentioned, "I have created a responsive fixed top menu that opens when the Menu icon is clicked. However, I would like it to hide after clicking on one of the menu items to prevent it from covering part of the sliding sectio ...

Dropping anchor whilst skipping or jumping

One of my website elements is a drop anchor that connects from a downwards arrow situated at the bottom of a full-page parallax image to another section on the same page. The HTML code snippet for the drop anchor is as follows: <section id="first" cla ...

sending a selection of JSON string values to a jQuery function

I have a JSON string that contains different items, but I am only interested in the 'locked' array and would like to pass it to a jQuery function. The JSON string was generated using json_encode from PHP. {"ignored":[],"status":{"message":"succe ...

Is there a way to keep a div element anchored at the top of the page until I reach the bottom and then have it stick to the bottom as I continue

I have a question that I hope is clear enough! On my webpage, there is a div at the top that I want to move to the bottom when I scroll and reach the end of the page. Hopefully, you understand what I'm trying to achieve! If anyone has any ideas, I&ap ...

Is there a way to ensure the scroll bar remains at the bottom as new data is added?

Hey there Coding Enthusiasts! I'm currently working on developing a chat system and one of the features I'm trying to implement is keeping the scroll bar at the bottom. The goal is to ensure that when someone sends a message, the user doesn' ...

The revolution of Selenium 3.0: the gecko driver and marionette driver duo

Can you explain the relationship between GeckoDriver and Marionette driver and how they operate together? ...

Obtaining the file size on the client side using JSF RichFaces file upload

I am currently using version 4.3.2 of rich fileupload in JSF richfaces. The issue I am facing is that the files first get uploaded to the server and then an error is thrown if the file size exceeds a certain limit. Even though I have set a size restriction ...

Is there a way to submit the value of a textbox that has been generated dynamically using jQuery?

I am currently using the CodeIgniter framework and am attempting to incorporate textboxes in an HTML form. When the user clicks a button, a new textbox should be generated automatically using jQuery. However, when I submit the form, the values of the dynam ...

What is the best way to collaborate and distribute local npm packages within a shared repository across different teams?

Unique Scenario Imagine the structure of a folder as follows: /my-app /src /dist /some-library /src /dist package.json my-package.json Two npm packages are present: one for my-app and one for some-library. my-app relies on some-library. ...

What steps can be taken to resolve the issue of "Uncaught TypeError: undefined is not a function"?

Check out the JSfiddle link for reference: http://jsfiddle.net/mostthingsweb/cRayJ/1/ Including my code below along with an explanation of what's going wrong: This is a snippet from the HTML header, showing all the necessary links: <head> ...

Toggle sidebar: expand/collapse

Looking for some assistance with my website project. I currently have two arrows to open and close the sidebar, but I would like one button to handle both actions instead. Can someone help me edit my code snippet to achieve this? Keep in mind that I am new ...

Showing a JSON array with varying nested lengths in an HTML5 format

I have a JSON string containing nested arrays with elements of unequal lengths. I am looking to display this data on a page using either Javascript or Angular.js. { [ 'id':1, 'value':'tes1' 'nextLevel':[&ap ...

Turn off the scrollbar without losing the ability to scroll

Struggling with disabling the HTML scrollbar while keeping the scrolling ability and preserving the scrollbar of a text area. Check out my code here I attempted to use this CSS: html {overflow:hidden;} Although it partially worked, I'm not complete ...

Using callback functions to handle parameters in GET requests

Hey there, I'm currently diving into the world of callback functions and I have a burning question that needs clarification. Adding event listeners seems easy enough: $0.addEventListener("click", function(event){console.log(event)}); When you click s ...

Initial loading size of Google chart

After creating a Google chart, I noticed that on the initial load, the chart appears tiny. Although it becomes responsive when adjusting the screen size, I would prefer it to be responsive from the start. Please note that there is a dropdown menu for sele ...

Develop a custom function to determine if every element within the array is identical

Issue I am currently working on a function that evaluates an array to determine if all elements inside the array are identical. If they are, it should return true; otherwise, it should return false. However, I do not want the function to return true/false ...

Interested in leveraging string functions on the information retrieved from the API?

I am trying to utilize String functions such as slice(x,y), length() on the data received from the API. To achieve this, I first converted the data to a variable called mystr using JSON.stringify(obj), but encountered an issue where the console displayed: ...