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

238
Views
Selenium Python: How to fetch text/html data from <script> tag with javascript file from a web page?

The code looks like this:

<script async="" id="__NEXT_PAGE__/restaurants" src="/_next/static/~k5VPZk5KBtLKJOP7fLbR/pages/restaurants.js"></script>

<script async="" id="__NEXT_PAGE__/_app" src="/_next/static/~k5VPZk5KBtLKJOP7fLbR/pages/_app.js"></script>

<script async="" src="/_next/static/chunks/146.5cc25d7743407960833f.js"></script>

<script src="/_next/static/runtime/webpack-562f11f96da3918c3d37.js" async=""></script>

<script src="/_next/static/chunks/styles.4fc2149595e9293ccd52.js" async=""></script>

<script src="/_next/static/chunks/styles.4fc2149595e9293ccd52.js" async=""></script>

I used

webdriver.Chrome().find_element_by_id("NEXT_PAGE/restaurants").get_attribute("innerHtml") and

webdriver.Chrome().find_element_by_xpath("//script[@src='/_next/static/chunks/136.ff85cd2297a8e5bf9619.js']").get_attribute("innerHtml")

but they returned None.

I am not really sure if there is text inside the tag btw. This is the page: https://food.grab.com/ph/en/restaurants

I am trying to fetch latitude and longitude for restaurants on the pages after pressing 'load more' button. This info is available in tag with id = 'NEXT_DATA' for first 16 restaurants but beyond that it seems to be hidden somewhere. I know python but not javascript.

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!