Need help determining the relative Xpath of an item on a DropBox page

I've figured out the relative Xpath on one type of DropBox page that I work with, but the one shown here is giving me some trouble. I'm hoping that experienced folks like @ComplexPoint @DanThomas @jhein might be able to help me nail it down.

I receive an email from my client that provides the plain-English name of a DropBox folder, e.g. "Wav files sent on 12_12_2023 9-30-44 PM." These folders are always in the same parent folder ("Albums to Check").

I want to

  1. use the timestamp string from the email as my means of getting the relative Xpath to the folder,
  2. then (in a few more steps that I have working perfectly) construct a nice one-click task item on a DropBox Paper dashboard.

I have everything working – other than my own ability to determine the correct relative Xpath, so I'm not sure it's meaningful to post my macro here. But here's the relevant chunk:

I am leery of posting client pages here, but here is the container HTML for the example folder named above:

<tr class="mc-table-row mc-media-row mc-media-row-border mc-media-row-clickable mc-media-row-culled brws-file-row brws-row-click-selection-method" style="top: 420px;" draggable="false" aria-rowindex="8" aria-label="Name Wav files sent on 12_12_2023 9-30-44 PM, Modified 2023-12-21 3:34 am, Size 0 bytes, " data-filename="Wav files sent on 12_12_2023 9-30-44 PM" tabindex="-1" data-campaigns-element-id="browse-view-list-file"><td class="mc-table-cell mc-media-cell brws-checkbox-cell" style="flex: 1 1 0%;"><div class="brws-vertically-center brws-file-row-checkbox-target" data-testid="brws-file-row-checkbox"><span class="dig-Checkbox"><input class="dig-Checkbox-input" type="checkbox" aria-label="Select item" tabindex="-1" readonly=""><span class="dig-Checkbox-styles"></span><svg aria-hidden="true" width="20px" height="20px" viewBox="0 0 20 20" version="1.1" class="dig-Checkbox-indeterminate-icon" focusable="false"><rect x="5px" y="9px" width="10px" height="2px"></rect></svg><svg class="dig-Checkbox-checked-icon" aria-hidden="true" width="20px" height="20px" viewBox="0 0 20 20" fill="none" xmlns="" focusable="false"><path d="M1 4L4.5 7.5L11 1" stroke="currentColor" stroke-width="2" transform="translate(4, 6)"></path></svg></span></div></td><td class="mc-table-cell mc-media-cell" style="flex: 1 1 0%; min-height: 59px; width: 791px; min-width: 791px; max-width: 791px;"><div class="mc-media-cell-icon"><svg viewBox="0 0 40 40" fill="none" role="img" focusable="false" width="40" height="40" class="dig-ContentIcon brws-file-name-cell-icon dig-ContentIcon--small" data-testid="fallback-file-thumbnail"><path d="M15.002 7.004c.552.018.993.252 1.295.7l.785 2.12c.145.298.363.576.561.779.252.257.633.4 1.156.4H35.5l-.002 18c-.027.976-.3 1.594-.836 2.142-.565.577-1.383.858-2.41.858H8.748c-1.026 0-1.844-.28-2.409-.858-.564-.577-.838-1.415-.838-2.465V7.003h9.502Z" fill="var(--dig-color__foldericon__shadow, #8aa8ca)"></path><path d="M15.002 7.001c.552.018.993.252 1.295.7l.785 2.12c.145.298.363.576.561.779.252.257.633.4 1.156.4H35.5l-.002 16.84c-.027.976-.3 1.754-.836 2.302-.565.577-1.383.858-2.41.858H8.748c-1.026 0-1.844-.28-2.409-.858-.564-.577-.838-1.415-.838-2.465V7l9.502.001Z" fill="var(--dig-color__foldericon__container, #a1c9f7)"></path></svg></div><div class="brws-file-name-container brws-file-name-container--action-ui-inline-star"><div class="brws-file-name-container brws-file-name-container--action-ui-inline-star"><div class="brws-file-name-cell-text brws-vertically-center" draggable="true"><div class="mc-media-cell-text mc-media-cell-text-title"><div class="brws-file-name-cell-title-container"><a class="brws-file-name-cell-filename" href="/home/CK%20(1)/Albums%20to%20Check/Wav%20files%20sent%20on%2012_12_2023%209-30-44%20PM" tabindex="-1"><div aria-describedby="tooltip-ce6b122392962b63" class="_rc-hl-truncated-string__tooltip_1fh0k_28"><span class="brws-file-name-element _rc-hl-truncated-string__container_1fh0k_36" style="display: block;">Wav files sent on 12_12_2023 9-30-44 PM</span></div></a><span class="ax-visually-hidden">Folder</span></div></div><div class="mc-media-cell-text mc-media-cell-text-subtitle"></div></div><div class="brws-file-name-cell-star"><div><button class="star__toggle brws-file-name-star-button" role="button" aria-pressed="false" aria-label="Add to Starred" tabindex="-1" id="star-5b489c43-cd8b-a356-d316-2ddb02cbd41f" aria-labelledby="star-5b489c43-cd8b-a356-d316-2ddb02cbd41f"><span hidden="">Add to Starred</span><svg viewBox="0 0 24 24" fill="none" class="dig-UIIcon dig-UIIcon--standard" width="24" height="24" role="presentation" focusable="false"><path d="m20.836 9.911-6.105-.886L12 3.492 9.27 9.025l-6.106.886 4.43 4.319-.833 6.164L12 17.442l5.239 2.95-.834-6.162 4.43-4.319ZM12 15.72l-3.35 1.886.531-3.924-2.794-2.723 3.878-.564L12 6.882l1.735 3.514 3.878.563-2.795 2.724.532 3.924L12 15.72Z" fill="currentColor" vector-effect="non-scaling-stroke"></path></svg></button></div></div></div></div></td><td class="mc-table-cell mc-media-cell brws-file-shared-with-cell" style="flex: 1 1 0%; width: 160px; min-width: 160px; max-width: 160px;"><div class="brws-vertically-center brws-shared-with-wrapper"><div class="shared-with-members"><div><span class="dig-Text dig-Text--variant-paragraph dig-Text--size-standard dig-Text--color-standard membership-column-text" data-testid="membership-column-text"><button class="dig-StylelessButton audience-description dig-StylelessButton--pointer" aria-label="2 members [object Object]"><span class="dig-StylelessButton-content"><span class="dig-Text dig-Text--variant-paragraph dig-Text--size-standard dig-Text--color-standard">2 members</span></span></button></span></div></div></div></td><td class="mc-table-cell mc-media-cell mc-media-cell-double-line brws-file-modified-at-cell" style="flex: 1 1 0%; width: 200px; min-width: 200px; max-width: 200px;"><div class="mc-media-cell-content"><div class="mc-media-cell-text mc-media-cell-text-title"><span aria-hidden="true">--</span></div><div class="mc-media-cell-text mc-media-cell-text-subtitle"><span class="dig-Text dig-Text--variant-paragraph dig-Text--size-small dig-Text--color-faint"></span></div></div></td><td class="mc-table-cell mc-media-cell brws-file-size-cell" style="flex: 1 1 0%; width: 130px; min-width: 130px; max-width: 130px;"><div class="mc-media-cell-content"><div class="mc-media-cell-text mc-media-cell-text-title"><span aria-hidden="true">--</span></div></div></td><td class="brws-file-row-inline-action-bar--container"><div class="_container_izxke_1 brws-file-row-inline-action-bar brws-file-row-inline-action-bar--safari" data-testid="inline-action-bar-container" style="margin-left: -200.64px;"><button class="dig-Button dig-Button--opacity dig-Button--standard"><span class="dig-Button-content">Copy link</span></button><button class="dig-IconButton dig-IconButton--transparent dig-IconButton--standard" aria-label="Share"><span class="dig-IconButton-content"><svg viewBox="0 0 24 24" fill="none" class="dig-UIIcon dig-UIIcon--standard" width="24" height="24" role="presentation" focusable="false"><path d="M11 15.5V6.744l-3.484 3.3-1.032-1.088 5.266-4.989 5.266 4.989-1.032 1.088-3.484-3.3V15.5H11Z" fill="currentColor" vector-effect="non-scaling-stroke"></path><path d="M15 13v-1.5h3.5V20H5v-8.5h3.5V13h-2v5.5H17V13h-2Z" fill="currentColor" vector-effect="non-scaling-stroke"></path></svg></span></button><div class="dig-Menu"><div class="dig-ClickOutside"><button class="dig-IconButton dig-IconButton--transparent dig-IconButton--standard" aria-haspopup="true" aria-expanded="false" aria-label="More menu" data-testid="action-bar-overflow"><span class="dig-IconButton-content"><svg viewBox="0 0 24 24" fill="none" class="dig-UIIcon dig-UIIcon--standard" width="24" height="24" role="presentation" focusable="false"><path d="M12 10a1.857 1.857 0 0 0-2 2 1.857 1.857 0 0 0 2 2 1.857 1.857 0 0 0 2-2 1.857 1.857 0 0 0-2-2Zm6 0a1.857 1.857 0 0 0-2 2 1.858 1.858 0 0 0 2 2 1.857 1.857 0 0 0 2-2 1.857 1.857 0 0 0-2-2ZM6 10a1.857 1.857 0 0 0-2 2 1.857 1.857 0 0 0 2 2 1.856 1.856 0 0 0 2-2 1.857 1.857 0 0 0-2-2Z" fill="currentColor" vector-effect="non-scaling-stroke"></path></svg></span></button></div></div></div></td></tr>

And here is a screenshot in case that is helpful; the standard URL highlighted in the screenshot doesn't work for other users because it's relative to my personal dropbox account – and maybe I can work with the client to change that, but here it is:

Thank you X1,000,000,

The first thing to bear in mind is that no element has just one xpath – there are always choices – a number of different xpaths which have the same harvest.

There's a balance to be chosen between run-time efficiency and simplicity of path, for example:

//a will match all links anywhere on the page

whereas by making the xpath a bit more verbose, we can limit the searching to a smaller area within the structure of the page, like:


To match all links which:

  1. have the class brws-file-name-cell-filename, and
  2. contain the string 12_2023 in their href attribute (their url string)

you could, for example, write something like:

//a[@class="brws-file-name-cell-filename" and contains(@href,"12_2023")]

where there are multiple matches you have the choice of

  1. refining the conditions, for example, making the date more specific, or
  2. using a numeric index to specify the first (or, more generally, Nth) match

The match index is 1-based, and specified between square brackets.

For example, with a slightly more specifiic date string, and a match index too:

//a[@class="brws-file-name-cell-filename" and contains(@href,"12_12_2023")][1]

OH...! I was so close all along!
But your explanation got me the rest of the way there.

Thank you SO much for taking the time, @ComplexPoint!

I click the album folder using


(I'm using an example timestamp here, but it will be a token for a variable in practice)

then click the Copy Link graphical button:
on the resulting page using

//button[@aria-label="Copy link, applies to Wav files sent on 12_14_2023 5-04-16 PM"]

and then I can use Click at Found Image to get the Share link for my colleagues, which differs significantly from my in-account link:

Thanks again,

1 Like