VB.Net WebBrowser Control Ajax Click Value Getting Problem

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<pre class="prettyprint lang-vb

….
<script type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
Wicket.Event.add(window, "load", function(event) { $("#iconContainer6").click(function(){Plimus.web.ui.openNewWindow(http://www.gamecopypro.com);});});
/*-->]]>*/</script>

<script type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
…..
<div class="item-name-icon tooltip-marker " id="itemUrlIcon3a
<div id="iconContainer6" class="ui-state-default ui-corner-all ui-button-fade <span class="ui-icon ui-icon-extlink

How can I get value = http://www.gamecopypro.com from div id="iconContainer6"
I am using VB.net and webbrowser control and webbrowser1.documenttext + regexp works

Dim matches As MatchCollection = Regex.Matches(ie.DocumentText.ToString, "openNewWindow(.*)", RegexOptions.IgnoreCase)
dbg(matches.Count.ToString)
Dim tmp As String

If matches.Count > 0 Then
For i = 0 To matches.Count - 1
dbg(matches.Item(i).ToString)
tmp = Replace(matches.Item(i).ToString, "openNewWindow(", "")
tmp = Replace(tmp, ")", "")

mem += vbCrLf & tmp

Next
dbg(mem)

but it works only first time when document completed, Then it is not refreshing because of AJAX dynamic load
I am trying javascript but failing to get values from onClick

Dim head As HtmlElement = ie.Document.GetElementsByTagName("head")(0)
Dim scriptel As HtmlElement = ie.Document.CreateElement("script")
Dim element As IHTMLScriptElement = scriptel.DomElement
//alert(document.body.innerText);alert(x.length);
element.text = "function getlink(){var x=document.getElementsByTagName(div);"
element.text &= "var divs=;for (i=0;i<x.length;i++){var s=document.getElementsByTagName(div).getAttribute(id); if (s!=null){if(s.indexOf(iconContainer) > -1){divs+=n+s;for (z=0;z<document.getElementsByTagName(div).attributes.length;z++){var ss=document.getElementsByTagName(div).attributes[z].name;if(ss.indexOf(onclick)>-1){divs+=document.getElementsByTagName(div).attributes[z].firstChild.data}}; break}}} alert(divs);"

element.text &= ""
element.text &= ""
element.text &= ""
element.text &= "}"
head.AppendChild(scriptel)
ie.Document.InvokeScript("getlink")

[/code]
<br/>

View the full article
 
Back
Top