嗨,我在 WPF/C# 中编程并使用 awesomium WebControl
我试图点击这个:
<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>
我的代码 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");
}
}
我知道我找到了这个对象,当我得到属性时它没问题,但是点击不工作。
我展示了这个对象的方法,没有像 click 或 onclick 这样的方法。方法:
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
你能帮助我吗?
@Edit我为javascript找到了这个: 从非按钮元素触发按钮点击 但我不能在我的应用程序中使用它。