Selecting a dropdown option in webBrowser

O

ofiras

Hello,
After I navigate to a certain URL via webBrowser, I want to change the
selected option in a "select" element in the page. I know that I can
use "InvokeMember" to do certain methods, but I didn't find any list
of those methods so I don't even know if I can do it like that.
Please help,
Ofir.
 
I

Ignacio Machin ( .NET/ C# MVP )

Hello,
After I navigate to a certain URL via webBrowser, I want to change the
selected option in a "select" element in the page. I know that I can
use "InvokeMember" to do certain methods, but I didn't find any list
of those methods so I don't even know if I can do it like that.
Please help,
Ofir.

Hi,

You do not need InvokeMember (or reflection to be more exact) you need
to manipulate the DOM of the document.
 
O

ofiras

Hi,

You do not need InvokeMember (or reflection to be more exact) you need
to manipulate the DOM of the document.

Thanks for the answar, but i still can't do it... Can you please
exlain how can i do it? I managed to get the select as an HtmlElement
so it dosen't know that it is a select element, and there are no
releated methods for it.
Please help,
Ofir.
 
I

Ignacio Machin ( .NET/ C# MVP )

Thanks for the answar, but i still can't do it... Can you please
exlain how can i do it? I managed to get the select as an HtmlElement
so it dosen't know that it is a select element, and there are no
releated methods for it.
Please help,
Ofir.

Hi,

You are almost there :)
use HtmlElement.SetAttribute("selectedIndex","1");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top