开发者

Webbrowser: simulate mouse click on ul-li item in webpage

I'm automating process with one website using WebBrowser component C#/.Net The actual problem is that I do not know Javascript well to understand how things work under the mouse clicks on some elements.

For example, I have a page where ajax and jquery used开发者_JS百科 (I guess so ;) and there is a list of elements (it is a tree with subtrees). So when I click on the root element, loading progress is shown and content is changing without complete reload of the page. And subtree is also expanded.

The question is how to do This mouse click on root tree element using WebBrowser control? I can get aprropriate <LI> element for this root elem in the tree and there is a <span> with text only. If I call InvokeMember("click") it does nothing...

please advise..

Thanks, Michael.


you can simulate a event on any element. both of these will work.

$(selector).click(); // triggers a click event on the selector (Selectors are CSS like selector passed)

EDIT:

I don't understand yet from where you are starting to look for that li

$("li:has(span)").trigger("click"); // triggers a click event on the `li`
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜