c# - Trigger a click from a non-button element -
hi im programming in wpf/c# , using awesomium webcontrol
i'm trying click in this:
<li class="playlist-item-favorite" data-title="ulubione" data-is-private="false"> <a href="javascript: void(0);"> <span class="playlist-title"> ulubione <span class="playlist-video-count-container"> (<span class="playlist-video-count">1</span>) </span> </span> <span class="playlist-public-private"> publiczny </span> </a> </li>
my code c#:
dynamic lists = (jsobject)browser.executejavascriptwithresult("document.getelementsbyclassname('playlist-item-favorite')"); if (lists == null) return; length = lists.length; if (length == 0) return; using (lists) { using (jsobject obiekt = lists.invoke("item", 0)) obiekt.invokeasync("click"); } }
i know i've found object, when atributes ok, click dont work it.
i shows methods object , there no mothod click or onclick. methods:
insertadjacenthtml insertadjacenttext insertadjacentelement getattribute setattribute removeattribute getattributenode getelementsbytagname getattributens setattributens removeattributens getelementsbytagnamens getattributenodens hasattribute hasattributens focus blur scrollintoview scrollintoviewifneeded scrollbylines scrollbypages getelementsbyclassname queryselector queryselectorall webkitmatchesselector getclientrects getboundingclientrect setattributenode removeattributenode setattributenodens webkitrequestfullscreen insertbefore replacechild removechild appendchild haschildnodes clonenode normalize issupported hasattributes lookupprefix isdefaultnamespace lookupnamespaceuri addeventlistener removeeventlistener issamenode isequalnode comparedocumentposition contains dispatchevent
can me?
@edit found javascript: trigger button click non-button element can't use in app.
somewhere in web page's accompanying javascript there function bound <a>
element's click event - find is, call directly. if function in question references self
object, need reference function , call call
method on it, passing anchor element first parameter.
the alternative - you're trying - more complicated. anchor element doesn't have clicked()
function, instead need manually create event.
Comments
Post a Comment