In the WebBrowser there is this page (http://gttweb.5t.torino.it/gtt/en/percorsi/percorsi-ricerca.jsp) and there is the "destinationCity" ComboBox
. In VB.NET I use:
Dim DestinationComboBox As HtmlElement = MainWebBrowser.Document.All.Item("destinationCity") DestinationComboBox.SetAttribute("selectedindex", 1)
to change the ComboBox selectedIndex, but in Silverlight (in this WebBrowser
) there's only the InvokeScript
function.. How can I change the selectedIndex using InvokeScript()
? I've tried
InvokeScript("eval", "document.getElementById('destinationCity').selectedindex = 4")
But it doesn't work.. Help please!
Answer: 1
If you use Chrome Developer Tools, or FireBug to execute the following JavaScript against the given page, you will find that it does not work in a desktop browser:
document.getElementById('destinationCity').selectedindex = 4
JavaScript, and the selectedIndex
property are case sensitive. The following works:
document.getElementById('destinationCity').selectedIndex = 4
by : ColinEhttp://stackoverflow.com/users/249933
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog