7 Replies - 282 Views - Last Post: 27 June 2013 - 02:54 PM Rate Topic: -----

#1 Criel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 127
  • Joined: 11-March 11

Why am i able to find textarea on some websites(WebBrowser control)

Posted 27 June 2013 - 12:31 PM

Hi all,

I'm messing around with the WebBrowser control and trying to find certain tags like SCRIPT,DIV,TEXTAREA and noticed that on some websites(Youtube) it won't find it like it will on some other sites(Dreamincode). Is there something I'm not seeing here? The same code is being used from one website to the next, just finding it really curious how it works on some and not others.
Is This A Good Question/Topic? 0
  • +

Replies To: Why am i able to find textarea on some websites(WebBrowser control)

#2 DarenR  Icon User is offline

  • D.I.C Lover

Reputation: 433
  • View blog
  • Posts: 2,998
  • Joined: 12-January 10

Re: Why am i able to find textarea on some websites(WebBrowser control)

Posted 27 June 2013 - 12:32 PM

Maybe outside programs are blocked?
Was This Post Helpful? 0
  • +
  • -

#3 Criel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 127
  • Joined: 11-March 11

Re: Why am i able to find textarea on some websites(WebBrowser control)

Posted 27 June 2013 - 12:36 PM

I thought the same but I am able to click around on stuff on all websites(like click on videos, comments, channels, etc on youtube for example). Seems like the textarea isn't getting gathered and put into the webcontrol documents. So confused :)
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 8937
  • View blog
  • Posts: 33,462
  • Joined: 12-June 08

Re: Why am i able to find textarea on some websites(WebBrowser control)

Posted 27 June 2013 - 12:39 PM

Without seeing how you are gathering up this information - I can say there is a large propensity for sites, like youtube, to make a concerted effort to thwart folks from getting handles on buttons, textareas, etc.. you know so people do not cheat the system with views, thumbs up/down, spam comments, etc.
Was This Post Helpful? 0
  • +
  • -

#5 Criel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 127
  • Joined: 11-March 11

Re: Why am i able to find textarea on some websites(WebBrowser control)

Posted 27 June 2013 - 12:45 PM

I suppose that makes sense. Here's the code i'm using to try and search for a textarea. Is it a script or something that prevents vb from grabbing that tag? Just trying to understand how they would even block such a thing. Blows my mind what some people can create :o

If loadPage(URL, WebBrowser1) Then
For i = 0 To WebBrowser1.document.Domdocument.All.Length() - 1
HTMLElementMain = WebBrowser1.document.Domdocument.All.Item(i)
 If HTMLElementMain.TagName <> Nothing Then
                    If StrComp(HTMLElementMain.tagName, "textarea", CompareMethod.Text) = 0 Then
                        MessageBox.Show("found the text box", "Found", MessageBoxButtons.OK, MessageBoxIcon.Hand)
                        End If
                End If
            Next


Was This Post Helpful? 0
  • +
  • -

#6 dday9  Icon User is offline

  • D.I.C Head

Reputation: 17
  • View blog
  • Posts: 86
  • Joined: 17-April 13

Re: Why am i able to find textarea on some websites(WebBrowser control)

Posted 27 June 2013 - 01:26 PM

Some of YouTube's textboxes may not have the "textarea" tag. I just went and looked at the YouTube's html for the 'leave a comment' textbox and it seems as though that's the case. And probably reasons like modi123_1 suggested. If there's a legitimate reason why you need to access that, what I do is declare an element outside of a foreach block and then check each element inside a for/each block to see if that element's attributes match up with certain criteria:
Dim el As HtmlElement

For Each ele As HtmlElement In WebBrowser.document.All
   If ele.<first attribute> = <first attribute> AndAlso ele.<second attribute> = <second attribute> Then
      el = ele
   End If
Next

Dim str As String = el.GetAttribute("value")


Was This Post Helpful? 0
  • +
  • -

#7 Criel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 127
  • Joined: 11-March 11

Re: Why am i able to find textarea on some websites(WebBrowser control)

Posted 27 June 2013 - 01:37 PM

Thanks DDay9 :) No real reason, was just very curious why i wasn't able to find that ONE element. Thanks for everyone's input :)
Was This Post Helpful? 0
  • +
  • -

#8 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: Why am i able to find textarea on some websites(WebBrowser control)

Posted 27 June 2013 - 02:54 PM

View PostCriel, on 27 June 2013 - 02:37 PM, said:

Thanks DDay9 :)/> No real reason, was just very curious why i wasn't able to find that ONE element. Thanks for everyone's input :)/>

Are you sure that the page you are trying it with actually has the "textarea" string or Tag?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1