Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个需要价值的问题
string someValue = ((IJavaScriptExecutor)Global.Driver).ExecuteScript("$('#publication_title').val();"); Console.WriteLine(someValue);
任何的想法?
string someValue = ((IJavaScriptExecutor)Global.Driver).ExecuteScript("return $('#publication_title').val();");
是你正在寻找的。它需要更多的“推动”来告诉它“得到这个值并把它还给我”。
我还要说你可能甚至不需要这样做。如果您正在努力获取value元素的属性,最好这样做:
value
element.GetAttribute("value");