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)
Solved it using this method...
iframe1 = page.query_selector('xpath=/html/body/div[4]/iframe').content_frame()
iframe1.evaluate("...