Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

200
Views
Inject javascript fetch and XHR into Selenium with Python

There are several ways to scrape information from websites. Recently I've heard that you can open a selenium webdriver and inject JS on it to fetch specific url from within the website or to replicate AJAX calls.

For example

driver.execute_script("return fetch('www.yoururlhere')")

So, I have a couple of questions regarding it

1 - How do you actually fetch the answer? Inspecting the driver I can see the call but neither in the frontpage nor doing driver.page_source am I able to retrieve it.

2 - How would one replicate more complex requests calls where there is params or data?

requests.get(url=url,headers=headers,params=params)
requests.post(url=url,headers=headers, data=json.loads(data))

How does this work?

Thanks!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!