Search code examples
javascriptpythonhtmlanchorbrowser-automation

how to open all the links based filename on webpage table in one go and open in new tab


Have to automate this manual work ? any extension or query or script? any ideas how to do it

  1. Open page in with Filename anyfile.xlsx
  2. Right Click on Submit link and select open in new tab
  3. Replace in URL &ID=9012389 with &thevalue=g and submit
  4. Repeat Step 2 for next submit link

Filename Links


Solution

  • Press F12 to open javascript console and paste

    [...document.querySelectorAll('a')]
        .filter(a => a.href.match(/Submit/))
        .forEach(a => window.open(a.href.replace('&ID=9012389','&thevalue=g'))))
    

    Allow pasting if console asks confirmation.