VB.NET

Moderators: seancampbell
Number of threads: 4022
Number of posts: 10035

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
VB.Net WebBrowser Control Ajax Click Value Getting Problem Posted by eurgbp on 27 May 2012 at 8:09 AM
	VB.Net WebBrowser Control Ajax Click Value Getting Problem 
	
	….
<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"></span></div> </div>

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')[i].getAttribute('id'); if (s!=null){if(s.indexOf('iconContainer') > -1){divs+='\n'+s;for (z=0;z<document.getElementsByTagName('div')[i].attributes.length;z++){var ss=document.getElementsByTagName('div')[i].attributes[z].name;if(ss.indexOf('onclick')>-1){divs+=document.getElementsByTagName('div')[i].attributes[z].firstChild.data}}; break}}} alert(divs);"

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





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.