vb.net, webbrowser, many same classname -
yesterday asked how text in div has no id.
people gave me answer:
private sub button1_click(sender object, e eventargs) handles button1.click dim divs = webbrowser1.document.body.getelementsbytagname("div") each d htmlelement in divs if d.getattribute("classname") = "js-text-container" richtextbox1.text = d.innertext end if next
but i'm facing new problem: realized many articles have same class name "js-text-container , , when click button1
, in richtextbox text of last div class name...
how text in first div class named "js-text-container"?
just exit loop after found first element...
dim divs = webbrowser1.document.body.getelementsbytagname("div") each d htmlelement in divs if d.getattribute("classname") = "js-text-container" richtextbox1.text = d.innertext exit end if next
you should learn how use breakpoint , step code. would've notice right away.
Comments
Post a Comment