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

339
Views
Python Playwright Evaluate JS on hidden input

I'm trying to execute a javascript it works in console of the browser but playwright can not execute it.

Item is located inside a frame and is hidden.

    page.evaluate("""(answer)=>{
        document.getElementById('tc-answer').value = answer;
    }
    """, answer)

I may be doing something dumb here but i can not figure out what is wrong :( The error is below

playwright._impl._api_types.Error: TypeError: Cannot set properties of null (setting 'value')
    at eval (eval at evaluate (:178:30), <anonymous>:2:67)
    at UtilityScript.evaluate (<anonymous>:185:19)
    at UtilityScript.<anonymous> (<anonymous>:1:44)
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Solved it using this method...

iframe1 = page.query_selector('xpath=/html/body/div[4]/iframe').content_frame()
iframe1.evaluate("...
about 4 years ago · Juan Pablo Isaza Report
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!