Reputation: 1210
I have an element/tag/div in vb6 in the webbrowser that seems to have a background image applied to a div when it is rendered. I think it is injected via a script. I would like to get the style info for the div
.
I've tried .Style
on an element and it returns a MSCurrentStyleCSSProperties
object which I can't figure a way to iterate. This could also be the wrong way to get this info.
The background style is usually a url. If I have Style.backgroundImage
on an element then that only gets the initial style info. I want the 'computedstyle' I think.
The code so far is more air code:
Dim x
For Each x In WebBrowser2.document.getElementsByTagName("*")
'do something with the object to get the style info
'do somthing with x.Style ' x.Style returns MSCurrentStyleCSSProperties
next
Upvotes: 1
Views: 123
Reputation: 1210
For Each x In WebBrowser2.document.getElementsByTagName("*")
x.currentStyle.backgroundImage
Next
returns the string
url("pathToFile.jpg")
or other possible background-image values including the string 'none'.
The gotcha is that javascript manipulated dom doesn't signal when it has finished in the IE webbrowser in vb6. DocumentComplete and DownloadComplete events are only the start of the rendering. I used a timeout timer delay before the element iteration loop. Basically, you have to wait an unknown time to see the background images in the javascript manipulated dom.
Upvotes: 1