Hi Community
I am trying to fetch a link stored in an element on a web page and the plain text for that element.
The reason for this is the UI 'Click link on web page' doesn't work. The PAD UI spy, for some unknown reason, can't locate these elements. I even tried manually adding the path in the selector, but nothing worked.
I can easily inspect the element and find JS path, XPath, selector etc.
However I am unfortunately not capable enough to return the values properly in the 'Run javascript function' action and thus only get the dissappointing 'undefined' in results.
Any kind of help would be appreciated.
My function 😢:
function GetURL() {
var URL = document.querySelector('#brandBand_2 > div > div > div > div > div.centerRegion > div > div.listViewContainer > lightning-datatable > div.dt-outer-container > div > div > table > tbody > tr:nth-child(1) > th > lightning-primitive-cell-factory > span > div > lightning-formatted-url > a').textContent;
return URL;
}
Selector: #brandBand_2 > div > div > div > div > div.centerRegion > div > div.listViewContainer > lightning-datatable > div.dt-outer-container > div > div > table > tbody > tr:nth-child(1) > th > lightning-primitive-cell-factory > span > div > lightning-formatted-url > a
JS Path: document.querySelector("#brandBand_2 > div > div > div > div > div.centerRegion > div > div.listViewContainer > lightning-datatable > div.dt-outer-container > div > div > table > tbody > tr:nth-child(1) > th > lightning-primitive-cell-factory > span > div > lightning-formatted-url > a")
XPath: //*[@id="brandBand_2"]/div/div/div/div/div[2]/div/div[2]/lightning-datatable/div[2]/div/div/table/tbody/tr[1]/th/lightning-primitive-cell-factory/span/div/lightning-formatted-url/a
Thanks in advance!