0

Exception :

System.InvalidOperationException: 'unknown error: Cannot read property 'querySelector' of undefined

Code :

    string title = (string)js.ExecuteScript("return arguments[0].querySelector('#supplier-item-table_filter .form-control').value");

I am trying to get text from text box. Thanks

1 Answer 1

1

Your JS code is incorrect. The code refer to argument[0] which is the second parameter of js.ExecuteScript("your-script...",the-argument);. But you didn't pass the second parameter so it is error.

You can call querySelector from document object. See my code below.

string title = (string)js.ExecuteScript("return document.querySelector('#supplier-item-table_filter .form-control').value");
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.