Skip to content
Advertisement

JS: Is it possible to set variables (as I want) on Chrome Developer Tools and firing functions?

I’ve been trying to create the API calls on my own because there is no API access. I was trying to do it with fetch api. However, some security measures block me from doing that. I could not find a way to get around this.

Therefore, I am trying to find the function that the send button fires. Set variables according to their functions and then fire it on Chrome Developer Tool Console.

Will this simulate how I actually send the POST request manually by clicking?

Advertisement

Answer

It’s possible. There will be no way to automate this, though, and you’ll need to manually paste all of your commands into the Dev Tool console every time for it to work.

A better approach is to use Playwright (or Puppeteer or Selenium or similar tool), which is a headless browser that you can control with code.

An even better approach might be to see what security measures are blocking you. Is it CORS? If so, you should be able to make the requests programmatically using Got or Axios. If it’s a CSRF token, then you likely will need to use a real browser to make the requests.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement