【发布时间】:2013-04-05 16:43:42
【问题描述】:
你好,我在 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
你能帮帮我吗?
@编辑 我为javascript找到了这个: Trigger a button click from a non-button element 但我不能在我的应用程序中使用它。
【问题讨论】:
-
为什么这被标记为 WPF?它与 WPF 无关。
标签: c# javascript awesomium