Getelementbyclass - 问题 [英] Getelementbyclass - Issue
问题描述
嗨
if(webbrowser1.documenttext.contains
{
webbrowser1.document.getelementbyid(aria-id-) 29371579884).InvokeMember(点击)
messagebox.show
}
但是getelementbyclass不存在怎么能通过获得一个类来实现相同的结果
ps创建一个新线程,因为它是一个不同的问题,但我知道它仍然是相关的
Hi
if (webbrowser1.documenttext.contains
{
webbrowser1.document.getelementbyid(aria-id-29371579884).InvokeMember("Click")
messagebox.show
}
However getelementbyclass does not exists how can i achieve the same result by by getting a class instead
p.s made a new thread because it is a different question but i know it is still related
推荐答案
不要尝试按类来做!如果你想使用一个唯一元素,只有属性id
应该保证唯一性。确保你有id =aria-id-29371579884。使用:
Don''t try to do it by class! If you want to use one unique element, only the attributeid
is supposed to guarantee uniqueness. Make sure you have id="aria-id-29371579884". Use:
someElement = document.getElementById("aria-id-29371579884"); // note casing and quotation marks!
// do something with the element
按类和许多其他选择器进行选择,请查看jQuery:http://api.jquery.com/category/selectors/ [ ^ ]。
请记住,除 id选择器之外的所有选择器都会为您提供元素集,不一定是一个。
For selection by class and many other selectors, check out jQuery: http://api.jquery.com/category/selectors/[^].
Remember that all selectors except the id selector gives you the set of element, not necessarily one.
这篇关于Getelementbyclass - 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!