3

I'm doing automated testing using Laravel Dusk, when I do this:

$test = $browser->script('$(".page-sidebar-menu").text();');
dd($test);

It returns array of null, but if run $(".page-sidebar-menu").text(); in a browser, it returns all text inside that class.

Where I go wrong in here? Please help if you know.

1 Answer 1

9

Okay it's wrong of me to asked this, I not include return inside script it should be like this

$test = $browser->script('return $(".page-sidebar-menu").text();'); dd($test);

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.