• Top Members
    Reps
    Posts
  • 834 Replies
    2585 Replies
  • 716 Replies
    2025 Replies
  • 331 Replies
    1928 Replies

Manipulating WebPage Content

User avatar
CodenStuff
Site Admin
Posts: 4367

Manipulating WebPage Content

Tue May 10, 2011 10:55 pm

Hello,

How to manipulate a webpages content do things like auto-login, form filling, locating elements and executing clicks.

This is the quickest way at this current time to do this and its a very simple replacement for any code you already use. For example if you added a webbrowser control to a form and wanted it to goto a specific page you would use:

Code: Select all

WebBrowser1.Navigate("www.site.com")
And to use that same function in V3R from your add-in you simply change the code to this:

Code: Select all

CType(Parent.FindForm.Controls(MainPanel).Controls(WebPanel).Controls.Item(0).Controls(Browser), WebBrowser).Navigate("www.site.com")
If you wanted to get a list of images from your webbrowser and add the links into a listbox you would use this:

Code: Select all

For Each ImageLink As HtmlElement In WebBrowser1.Document.Images 
Listbox1.items.add(ImageLink.GetAttribute("src")) 
Next 
But to do the same thing from an add-in in V3R you would change the code to this:

Code: Select all

For Each ImageLink As HtmlElement In CType(Parent.FindForm.Controls(MainPanel).Controls(WebPanel).Controls.Item(0).Controls(Browser), WebBrowser).Document.Images 
Listbox1.items.add(ImageLink.GetAttribute("src")) 
Next 

And thats all their is to it. All you do is change "WebBrowser1" in your code to this:

Code: Select all

CType(Parent.FindForm.Controls(MainPanel).Controls(WebPanel).Controls.Item(0).Controls(Browser), WebBrowser)
That simply accesses the currently visible browser on the V3R screen which gives you access to do whatever you want with it cooll;

Remember this code WILL change on final release so keep your source-code so you can make any changes later otherwise any add-ins you make wont work when V3R is released properly :?
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.

Locked

Return to “Tutorials”