1

I have a issue i need value from

string someValue = ((IJavaScriptExecutor)Global.Driver).ExecuteScript("$('#publication_title').val();");

Console.WriteLine(someValue);

Any idea?

1 Answer 1

6
string someValue = ((IJavaScriptExecutor)Global.Driver).ExecuteScript("return $('#publication_title').val();");

Is what you are looking for. It needs a little more "pushing" to tell it "get this value and give it back to me".

I'd also say you probably don't even need to do this. If you are struggling to get the value property of an element, it's better to do:

element.GetAttribute("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.