7

I can't pass arguments to function passed to page.evaluate. I am trying to submit form.

data1 = "Textsample"; page.evaluate(function(data1) { var form = document.getElementById ("MyForm"); form.data.value = data1; form.submit(); }); 

But when I'am taking screenshot of page the data field is filled with "undefined". What am I doing wrong and how to fix it?

1 Answer 1

12

You need to pass it as 2nd arg in page.evaluate.

page.evaluate(function(arg){},arg); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.