I’m trying to extracted some complex html table with the combination of jquery using $ and common java script commands but i’m ended up with error _clientFunc is not a function
The first red flag I see are double quotes. The Inject Javascript activity will not accept double quotes in your function. Thankfully, JavaScript like PowerShell allows use of single quote on string values. So could you try the below code. I have made some changes to your code.
function ExtractTable() {
var script=document.createElement('script');
script.src='//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js';
script.onload=function() {
var table=$('[grid_ref_page='TempRegionList.pxResults(1)']')[0];
var rows=table.getElementsByTagName('tr');
var JurisdictionValue=rows[2].querySelector('td[data-attribute-name]=Jurisdiction').innerText
};
JurisdictionValue.appendChild(script);
return JurisdictionValue;
}();
You were also missing a “]” in var JurisdictionValue=rows[2].querySelector('td[data-attribute-name=Jurisdiction').innerText
Another thing I am uncertain of is how Inject JavaScript handles your return value (JurisdictionValue). The return value will need to be cast to a datatable since you are trying to scrape a “td”
I cannot test it as I have no idea which website you are trying this on.
You can download it from the link above, or alternatively, search “jqueryexecution” in your UiPath Studio’s Manage Packages window.
Please have a look at the user guide document for details if needed.
Hope you find this helpful.
Thanks.