I am trying to load the load on a webpage in a C # WebBrowser control (WPF is not WinForm). Along with other content on the page there is an image rotator that dynamically creates two divs that have the same class to use a rotating image. In the LoadComplete event of the WebBrowser control, I attach a stylesheet to hide the two divs. The two divs created dynamically when the page loads are the following:
<div class="backgroundImageDivsClass" style=" width: 100%; height: 100%; position: fixed; top: 0px; left: 0px; padding: 0px; margin: 0px; z-index: -9999; opacity: 1; background-image: url("data/767/Course/9214/1000000001_474030834.jpg"); background-position: left top; background-size: 100% 100%; background-repeat: no-repeat; "></div> <div class="backgroundImageDivsClass"></div>
And the way css is assigned inside the LoadComplete event of the webbrowser control:
mshtml.IHTMLStyleSheet styleSheet = Document.createStyleSheet(string.Empty, 0); styleSheet.cssText = @".backgroundImageDivsClass{display:none;}";
But this seems to be inoperable because it does not hide the div. Someone please give me an idea of ββwhat I am missing.
source share