Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
i am ghaving a go button(s) here
how can i simulate click event on the id go image here please
here is my peace of code
vb.net Code:
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
With Me.WebBrowser1
.Document.All.Item("CrewID").InnerText() = "UBL1425"
' .Document.All.Item(13).InvokeMember("click") ' no action
.Document.GetElementById("searchgo.gif").InvokeMember("click") ' no action
'' button names used
''searchgo.gif
'' "go"
End With
End Sub
:wave:
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hi kleinma, I was reading your posts and this is just what I am looking to do.
I cannot seem to work out how to input my log in details to a desired website using the VB form.
I know I just need to get some code from the website and manipulate it into the VB code but I am not sure how to go about this.
I would really appreciate if you could point me in the right direction.
Thanks,
ecktronic
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
I bought a script vbulletin for install it in my forum, now I have a discuzx forum on www.cristovideos.com/forum.php but I dont like this script. I trying to change my app from discuzx to vbulletin, I using this app for send pms to my members. The application is almost finished. only the last thing I need is that I can not fill the message. I still I have no forum installed and I am testing my app with another forum and I can not insert the message.
I trying with this code :
"wbForumpm.Document.Window.Frames("vB_Editor_001").Document.Body.InnerHtml = txtPMBody.Text"
and this code:
"'Body set
If Unit.GetAttribute("name") = "message" Then
Unit.SetAttribute("value", txtPMBody.Text)
End If"
But not work. I think that you can do it God willing .
I bought vbulletin 4 like http://www.webtalkforums.com/private...wpm&u=90020380 .
Thanks advanced.God bless you.
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
WebBrowser1.Navigate("URL of PAGE WITH MESSAGAE BOX")
WebBrowser1.Document.All("NAME OF MESSAGE BOX").InnerText = "TEXT TO SEND"
WebBrowser1.Document.GetElementById("NAME OF BUTTON").RaiseEvent("onclick")
That should work. :)
Let me know how you get on.
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Quote:
Originally Posted by
ecktronic
WebBrowser1.Navigate("URL of PAGE WITH MESSAGAE BOX")
WebBrowser1.Document.All("NAME OF MESSAGE BOX").InnerText = "TEXT TO SEND"
WebBrowser1.Document.GetElementById("NAME OF BUTTON").RaiseEvent("onclick")
That should work. :)
Let me know how you get on.
Thanks, but I can not do this. This is the html code.
Code:
<!-- message area -->
<!-- / Editor Scripts --><div id="vB_Editor_001" class="blockrow texteditor">
<div class="editor">
<div class="editor_textbox_container smilie">
<div class="editor_textbox editor_textbox_smilie">
<textarea id="vB_Editor_001_editor" name="message" rows="8" cols="60" autocomplete="off" tabindex="1"></textarea>
</div>
</div>
<div class="editor_smiliebox">
<ul class="smiliebox floatcontainer" id="vB_Editor_001_smiliebox">
<li>
<div class="table">
<div class="tablecell">
<img src="images/smilies/frown.png" id="vB_Editor_001_smilie_1209" alt=":(" title="Frown" border="" />
</div>
</div>
</li>
<li>
<div class="table">
<div class="tablecell">
<img src="images/smilies/mad.png" id="vB_Editor_001_smilie_1210" alt=":mad:" title="Mad" border="" />
</div>
</div>
</li>
<li>
<div class="table">
<div class="tablecell">
<img src="images/smilies/redface.png" id="vB_Editor_001_smilie_1211" alt=":redface:" title="Redface" border="" />
</div>
</div>
</li>
<li>
<div class="table">
<div class="tablecell">
<img src="images/smilies/rolleyes.png" id="vB_Editor_001_smilie_1212" alt=":rolleyes:" title="Rolleyes" border="" />
</div>
</div>
</li>
<li>
<div class="table">
<div class="tablecell">
<img src="images/smilies/smile.png" id="vB_Editor_001_smilie_1213" alt=":)" title="Smile" border="" />
</div>
</div>
</li>
<li>
<div class="table">
<div class="tablecell">
<img src="images/smilies/tongue.png" id="vB_Editor_001_smilie_1214" alt=":p" title="Tongue" border="" />
</div>
</div>
</li>
<li>
<div class="table">
<div class="tablecell">
<img src="images/smilies/wink.png" id="vB_Editor_001_smilie_1215" alt=";)" title="Wink" border="" />
</div>
</div>
</li>
<li>
<div class="table">
<div class="tablecell">
<img src="images/smilies/biggrin.png" id="vB_Editor_001_smilie_1205" alt=":D" title="Biggrin" border="" />
</div>
</div>
</li>
<li>
<div class="table">
<div class="tablecell">
<img src="images/smilies/confused.png" id="vB_Editor_001_smilie_1206" alt=":confused:" title="Confused" border="" />
</div>
</div>
</li>
<li>
<div class="table">
<div class="tablecell">
<img src="images/smilies/cool.png" id="vB_Editor_001_smilie_1207" alt=":cool:" title="Cool" border="" />
</div>
</div>
</li>
<li>
<div class="table">
<div class="tablecell">
<img src="images/smilies/eek.png" id="vB_Editor_001_smilie_1208" alt=":o" title="Eek" border="" />
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
<input type="hidden" name="wysiwyg" id="vB_Editor_001_mode" value="1" />
<!-- / message area -->
Also this code :
<body class="forum" contenteditable="true" spellcheck="true" style="height: auto;">
<br type="_moz">
</body>
I already used:
message
vB_Editor_001_editor
But not work. Thanks in advanced.
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Oops, I didn't realise you were using HTML sorry!
Hope you manage to figure this out.
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
No, I am using VB 2010 but this is the html of the vbulletin, I need help for find the right html element to use it in my app.
Quote:
Originally Posted by
ecktronic
Oops, I didn't realise you were using HTML sorry!
Hope you manage to figure this out.
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hi, I am new to this- I have a VB.net project in VS2005, and I added an HTML.htm window form to it. I put a button the form and I would like to have the onclick event run a vb sub. I know I need an event handler or the sub, but how do I get the name of the html button in the vb addhandler statement?
1 Attachment(s)
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hi kleinma
i saw ur app . thats amazin and works fine for me !
but now i have question.
i want to click on some ads on site . but i cant find this as links in your application's getlinks() sub .
can u download this attachment and learn me how to click on this via vb.net ?
i attached html source . but forum rules deny it . plz download attachment and then rename it from test.txt to test.html !
thanks in advance
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
i get the picture on website, then i need my application auto text values of the picture...
can u help me with this problem??
this my code for get the image:
Code:
Dim doc As IHTMLDocument2 = WebBrowser1.Document.DomDocument
Dim imgRange As IHTMLControlRange = CType(doc.body, HTMLBody).createControlRange
For Each img As IHTMLImgElement In doc.images
If img.GetAttribute("src").ToString.Contains("image.php") Then
imgRange.add(img)
imgRange.execCommand("Copy", False, Nothing)
PictureBox1.Image = Clipboard.GetDataObject.GetData(DataFormats.Bitmap)
Exit For
End If
Next
http://www.vbforums.com/attachment.p...1&d=1325308898
My Problen on Thread
http://www.vbforums.com/showthread.p...54#post4111754
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
@afdoal you need to use a decaptcha service or delve into image processing (OCR)
Can anyone help on how to simulate typing, which is a combination of onkeydown, onkeypress and onkeyup events?
regards
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
@kleinma:
I have some trouble determining the completed event.
Code:
' Load the url
Private Sub frmTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim orgurl As String = "url"
wb.Navigate(orgurl)
End Sub
'Document completed event
Private Sub webBrowser_DocumentCompleted(sender As Object, e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) Handles wb.DocumentComplete
'Change the value in the txt box, and submit
DirectCast(GetCurrentWebDoc.getElementById("ctl00_mainContent_Live3Price1_NEW_wdcDate_dateInput_TextBox"), mshtml.HTMLInputElement).value = "22/06/2012"
DirectCast(GetCurrentWebDoc.getElementById("ctl00_mainContent_Live3Price1_NEW_Button1"), mshtml.HTMLInputElement).click()
'AFTER submit, content will be loaded. The submit button call AJAX to load data into table. Url unchanged.
'But the ready state already be "Complete"
'I'v tried WebBrowserReadyState.Complete and SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE , but get the same result, their state will be "Complete", even when browser still loading the content.
If wb.ReadyState = WebBrowserReadyState.Complete Then
MessageBox.Show("Done")
End If
End Sub
How to check if browser has completely loaded (after AJAX)?
I have to parse the source code (after AJAX), and need to check the state of browser
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hi all ,
can any one help me with this :
a program takes value from txt document and fills it in to online registration form. so i dont need it to do in manualy over and over again . I just change the txt file every time i need to create new .
lets say . "mr bob brown". have to be filled in to online registration form . lets say register.jabber.org.
so i just need to pres button "register" on a webpage . or better the program to have a button too :) after fill execute (but offcourse it will be hard to avoid the HUMAN CHECK box ) but still i need help in this :) I dont need passing by check box . i need to auto fill . "roboform" similer to this but simpler .
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
I need help filling out the region and the category this web page. http://www.inetgiant.com/item/new It wants you to physically click it. I got everything else i need to work. Please help.
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Was wondering if you updated this to 2005 browser. I use default webbrowser (extended) that I found on some scratch code. Its actually 2005 IE. It doesn't want to convert my html source to mshtml .
Code:
Try
Dim GetCurrentWebDoc As mshtml.HTMLDocument = DirectCast(wb.Document, mshtml.HTMLDocument)
Dim MyDiv As mshtml.HTMLDivElement = DirectCast(GetCurrentWebDoc.getElementsByTagName("img"), mshtml.HTMLDivElement)
If MyDiv.getAttribute("className") = "vam hand" Then
MessageBox.Show(MyDiv.getAttribute("onclick"))
End If
Catch
MsgBox(ErrorToString, MsgBoxStyle.Critical)
End Try
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
SOLVED
VS 2010 converts automaticly.
Quote:
Originally Posted by
kleinma
All the time I see people asking how to autofill in forms on webpages or how to click a button in a webpage that is hosted in the webbrowser control, via VB code.
It is really not all that difficult, once you get around the casting of types to the correct kind when using the COM reference.
This example project highlights the following manipulations (as well as opening the door to manipulate just about anything on a webpage that is possible)
* Getting a value of an HTML input element
* Setting a value of a HTML input element
* Getting a value of an HTML text area
* Setting a value of a HTML text area
* Set HTML radio buttons selected or not
* Click an HTML button
* Submit an HTML Form
* Get the sources for all images in HTML document
* Get and display all the links in the HTML document
* Alter non form elements (like changing the color of a DIV tag)
* Getting values from an HTML Select element (value and selected index)
* Display page HTML source
* Run a javascript that is in the HTML Page
* click a checkbox in an HTML form
* Print the current page (with printer selection dialog)
* Added 8/24/2006 - Highlight webpage text via code
This specific example code is done using
Visual Studio 2005 (VB.NET)
However I use the COM WB Control, not the built in .NET 2.0 WB Control (because its functionality is rather limited)
I also use a reference to the MSHTML scripting engine, which is what allows you to parse a webpage into all its elements so you can manipulate them.
Please let me know if you have any questions/comments/suggestions.
I can add more functionality examples if someone can think of one....
Hello
This looks to be exactly what i need to start on a tool at the company i work for, do you have it on VB 2010? i am having dificulties to open it.
Any idea how to solv this?
Thank you any way, im sure i´ll find a way to make it work.
Best regards.
Blitz
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
The project page "TestPage.htm" shows signs of a budding star in web design. Some real layout talent there.
On a more serious note, I'm sure I speak for many when I say thank you. Your post is well written and it has obviously helped many of us who still have a lot to learn. I've used your code as a starting point on more than one project. Again, thank you kleinma.
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
I need to fill this text area but the value of class and ID changes:
<div aria-labelledby="255" role="textbox" g_editable="true" class="df b-K b-K-Xb URaP8 editable" id=":78.f" contenteditable="true"></div>
How can I have success ?
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Dear every predecessors,
This is a super helpful thread. I am not sure if anyone still following the thread, I hope there is a little chance somebody could help:p
Right now, I am trying to fill forms on website, I did it with "Sendkeys", but by reading #196, it is not appropriate.
Code:
WebBrowser1.Navigate("https://mybank.icbc.com.cn/icbc/enperbank/index.jsp")
WaitForPageLoad()
TextBox1.Text = WebBrowser1.Url.ToString
SendKeys.Send("UserABC")
SendKeys.Send("{TAB}")
SendKeys.Send("Password")
Code:
Private Property pageready As Boolean = False
#Region "Page Loading Functions"
Private Sub WaitForPageLoad()
AddHandler WebBrowser1.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf PageWaiter)
While Not pageready
Application.DoEvents()
End While
pageready = False
End Sub
Private Sub PageWaiter(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs)
If WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
pageready = True
RemoveHandler WebBrowser1.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf PageWaiter)
End If
End Sub
#End Region
I believe that the login form is an ActiveX control ttps://mybank.icbc.com.cn/icbc/enperbank/index.jsp
The source code of the password field:
Code:
<OBJECT onkeyup="getfocus1('KeyPart', event);detectCapsLock('logonform','safeEdit1',500,300,400,'logontb');" onfocus="detectCapsLock('logonform','safeEdit1',500,300,400,'logontb')" onblur="closeCapTip('logonform','safeEdit1')" id=safeEdit1 codeBase="/icbc/newperbank/AxSafeControls.cab#version=1,0,0,13" classid=CLSID:73E4740C-08EB-4133-896B-8D0A7C9EE3CD width=145 height=21><PARAM NAME="_cx" VALUE="3836"><PARAM NAME="_cy" VALUE="556"></OBJECT>
Is there a way to pass value into the password field with it ID/name??
Thank you for any advice!!!