Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Vb.net Webbrowser Control Ajax Click Value Getting Problem

VB.NET ajax

  • Please log in to reply
1 reply to this topic

#1 eurusd

eurusd

    CC Lurker

  • New Member
  • Pip
  • 9 posts

Posted 27 May 2012 - 07:13 AM






….

<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")




  • 0

#2 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts
  • Location:Argentina
  • Programming Language:C, C++, C#, PHP, JavaScript, Transact-SQL, Bash, Others
  • Learning:Java, Others

Posted 27 May 2012 - 08:22 AM

i see you are using this :
Plimus.web.ui i don't know how that works, but it looks to me like .openNewWindow() wouldn't be
its only method, did you check if Plimus.web.ui for another methods or members ?
my wild guess is you will find a .document or a .window or something there that will provide you with the info you need.

please go check that and come back :D , am sure we can work up some solution together.
  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download