async getActionButton(label) {
const actions = await this.getActionButtons()
if (actions.length > 0) {
for (let item of actions) {
let itemLabel = await item.getLabel() ?? await item.elem.getAttribute('aria-label');
if (itemLabel.indexOf(label) > -1) {
return item;
}
}
}
return undefined;
}
This basically, checks both the label and the aria-label.
However, that begs the question, why (in my case) is it not finding the button by label currently? I am still not sure yet.
This is what the DOM ends up looking like. The label prop passed to getActionButton(label) is the text in the aria-label such as Action Item 1 or Action Item 2.
I have run into an issue, not 100% sure that I have identified the root cause correctly yet though, so this may be a red-herring.
However, this change did help me move forward.
The
getActionButton
function in theTreeItem
class inpageObjects/sidebar/viewItem.js
appears to throw because it is unable to find an action Button.Current:
Suggested Change:
This basically, checks both the
label
and thearia-label
.However, that begs the question, why (in my case) is it not finding the button by label currently? I am still not sure yet.
This is what the DOM ends up looking like. The
label
prop passed togetActionButton(label)
is the text in the aria-label such asAction Item 1
orAction Item 2
.