简体   繁体   中英

How to perform a Click in C# in stead of Javascript

For a project on school I have to make an application which can fill in a form from a second hand selling page. This is the page : http://www.2dehands.be/plaats/

My problem : If I execute javascript like this :

document.getElementById("level1-option").selectedIndex = "1";

it does select the right index.

But it seems like the site asks a real 'click' event. How do I do that.

You may be looking for http://www.dotnetspider.com/resources/1521-How-call-Postback-from-Javascript.aspx

Do let me know if doesn't works

You can try this

document.getElementById("level1-option").fireEvent("onchange");

or

// Create a new 'change' event
var event = new Event('change');

// Trigger it.
element.dispatchEvent(event);

Triggering events manualy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM