Skip to main content
Question

JavaScript doubt

  • May 11, 2023
  • 4 replies
  • 85 views

Forum|alt.badge.img+1

const deviceManagement = document.querySelector('body > form:nth-child(21) > table:nth-child(4) > tbody:nth-child(1) > tr:nth-child(2) > td:nth-child(1) > div:nth-child(6) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(6) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(2)');
deviceManagement.dispatchEvent(new MouseEvent('mouseover', { bubbles: true }));

setTimeout(() => {
  const deviceList = document.querySelector('body > div:nth-child(18) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(1) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(2)');
  deviceList.click();
}, 1000);

I have this code but i can’t able to run it in the java script action.

4 replies

Forum|alt.badge.img+1

Hello, I am experiencing a similar issue with having code that works but I am unable to get it to run in AA360. Were you able to get this resolved?


Forum|alt.badge.img+5
  • Navigator | Tier 3
  • November 29, 2024

I’m having the same issue with the following code, which runs fine. But any attempt to use RegExp in javascript is returning “bot error”.

 

function string_parse(source, regex) {
    return source.match(new RegExp(regex)).toString();
}

results = string_parse(
    'PCAGoldenValleyMinneapolisOpportunities_ST20240501-ED20241101_20240820-0855-PACOA-FRV.xls',
    '^([A-Za-z0-9\\-]+)_ST(\\d{8})-ED(\\d{8})_((\\d{8}-\\d{4})-([A-Za-z0-9]+)-[A-Za-z0-9]+)\\.xls'
    //'^(?<Description>[A-Za-z0-9\\-]+)_ST(?<StartDate>\\d{8})-ED(?<EndDate>\\d{8})_(?<BidId>(?<BidDateTime>\\d{8}-\\d{4})-(?<BidCustomerCode>[A-Za-z0-9]+)-[A-Za-z0-9]+)\\.xls'
);

console.log(results);
 


Shreya.Kumar
Pathfinder Community Team
Forum|alt.badge.img+14
  • Pathfinder Community Team
  • July 25, 2025

try upgrading your JavaScript package to the latest version. If the issues persist, please paste a screenshot of the error on this thread!


Padmakumar
Premier Pathfinder | Tier 7
Forum|alt.badge.img+15
  • Premier Pathfinder | Tier 7
  • July 25, 2025

Hi ​@jeganmurali ,

 

Could you please try the below script and let me know?

 

const deviceManagement = document.querySelector('td:nth-child(2)'); // Try simplifying the selector

if (deviceManagement) {
  deviceManagement.dispatchEvent(new MouseEvent('mouseover', { bubbles: true }));

  const interval = setInterval(() => {
    const deviceList = document.querySelector('div:nth-child(18) td:nth-child(2)');
    if (deviceList) {
      deviceList.click();
      clearInterval(interval);
    }
  }, 500);
} else {
  console.log('deviceManagement element not found');
}