-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
I meant Visual Studio v.6.
And,yes.
You see the problem is that i usually go to this site with many images.Now i don't need all those images except for one which is present in a certain web page which is the reason i can't disable all images on my browser since i need to keep the image activated on one single webpage on that site but don't need other images on that website.
The images take alot of my internet speed you see.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
@klienma
Thanks for this tutorial..I figured it how to auto fill textbox in form and solve my problem..
I got a question for you.
Is it possible to collect data in this page with table. link here
Is t possible to collect and view the data from tables into a ListView control in winForm?
Instead of viewing page in webbrowser. i just want to use listview.
Thanks for the help..
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
kleinma!!!
4 years and you are still helping! You are amazing. Just finished reading 13 pages and what an amazing person you are! Wow! Never come across a guru like you!
Joined this forum to ask for help!
I have a web browser control through which I am able to pass the user name and password and invoke a submit event. The problem now is that as soon as a login happens, a PDF file is downloaded and this appears in a File Download dialog box. The point is that I am trying to build a windows application which is automated. So there is no room for popups or dialog boxes. What I actually need to do is to capture this pdf download onto the local disk without the File Dialog intervention.
I have struggled with this for a month. No luck! I pray to god that u read this post and help me!
Thanks for all the great work you are doing!
Cheers,
iceqb
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
ahh my friend flattery will get you no where with me ;)
When you log into the page, is the page that you end up at actually a PDF document? Or do you end up at a normal webpage which spawns a PDF in a popup window? One thing I find odd is that you are getting a file download dialog for a PDF document. That usually only happens when you don't have a PDF reader installed. When I navigate to a PDF either in IE or the browser control, it simply opens up either in the browser directly, or in adobe reader/acrobat.
So what is the exact behavior going on ?
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Thanks for the quick response. Yes, like you guessed, I do not have pdf reader installed on a server machine. And as u said again, post authentication, I end up with a pdf file. So is it possible to capture this download into a file within a browser control. (There will be no instances of PDF reader on the machine)!
Please help!
Thank you a million!
Cheers,
IceQB
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
BTW, missed out to mention. I really meant what I said. and wasn't intended to turn out as flattery. :-P
Thanks once again!
Cheers,
IceQB
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Well, I don't know the ins and outs of how your exact web app works that you are trying to do this for. If it works how I assume it does, you may be able to do something like this:
in the navigating event of the browser, you can cancel navigation. So IF in fact this event fires when the PDF doc is navigated to, you could grab the URL, and then cancel navigation, and download the file manually since you would have the URL to it. Depending on if authentication would block this or not, I guess that it something you would have to test.
Something along these lines:
note it assumes the URL of the PDF actually ends with pdf (there is no extra data after in the URL)
Code:
Private Sub WebBrowser1_Navigating(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles WebBrowser1.Navigating
If e.Url.ToString.EndsWith("pdf") Then
Dim myFileURL As String = e.Url.ToString
My.Computer.Network.DownloadFile(e.Url.ToString, "C:\myfile.pdf")
e.Cancel = True
End If
End Sub
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Awesom. Thanks a lot pal. Will try an post. Thanks once again! :)
Cheers,
IceQB
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hi! kleinma pls help me i try to make an autosubmit program for this website:www.facebook.com
for the reg form.but i try many way for clicking the submit(Sign Up) button but i cant do it...could u help me??
I try .InvokeMember("submit")
System.Windows.Forms.SendKeys.Send("ENTER")
but it doesnt work:S
I use vb 2008, pls help me:/
many thanks!!
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hi kleinma,
i am able to login to a web page based on your above code....now i wanted to test all the username along with its pwd which is default 123456
user name from database will be check for pwd 123456 how can i get to know which all users has changed its pwd
i am able to login with correct username and password
i used WebBrowser1_NewWindow event because if user name is correct the url gets changed but how can i get to know that a particular users has changed its pwd
When Pwd is entered wrong there is no change in the url or no window is changed only the page display a warning message saying Login Failed ! Invalid Username or Password
Private Sub WebBrowser1_NewWindow(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles WebBrowser1.NewWindow
If WebBrowser1.Url.AbsoluteUri = "http://192.168.10.4/cgi/index.php?dispSession=1" Then
MsgBox("Correct Pwd")
End If
End Sub
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hi kleinma,
i am able to login to a web page....now i wanted to test all the username along with its pwd which is default 123456
user name from database will be check for pwd 123456 how can i get to know which all users has changed its pwd
i am able to login with correct username and password
i used WebBrowser1_NewWindow event because if user name is correct the url gets changed but how can i get to know that a particular users has changed its pwd
When Pwd is entered wrong there is no change in the url or no window is changed only the page display a warning message saying Login Failed ! Invalid Username or Password
Private Sub WebBrowser1_NewWindow(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles WebBrowser1.NewWindow
If WebBrowser1.Url.AbsoluteUri = "http://192.168.10.4/cgi/index.php?dispSession=1" Then
MsgBox("Correct Pwd")
End If
End Sub
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
I'm using VB6 and using the webbrowser control to fill the form and submit to a commercial website that has weather. The problem is I can determine that the initial website has completely loaded by using the DocumentCompleted method. I then can fill the form with the city that I want and submit. The DocumentCompleted subroutine is not triggered again. THe only way I could figure out how to wait for the response from the server was to count the number of TitleChange events that occurred. THen I can parse the page for the info I need.
Is there a more elegant way to do this in VB6?
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Is it possible to use VB Control (textbox & button) instead of loading external html to submit a form?
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Loading the website is simple and small code foot print. The webbrowser can be hidden so the user doesn't see anything. I'm thinking the ReadyState property holds the answer to my problem (though I see someone else is using the Title count also, wonder why)
Bypassing the webbrowser would require significant coding (cookies etc)
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Pls guys help mee i saw that u have a lot of work in this forum.
It iis so helpful. but i cant solved this problame.
I wanna fill a form and submit it ,i can fill it but the submit methode doesnt work:(
Code:
<input type="hidden" id="referrer" name="referrer" value="116" autocomplete="off" /><input type="hidden" id="challenge" name="challenge" value="f6c75d9cda8d09a31ccc9a59d3e1ab7a" autocomplete="off" /><input type="hidden" id="md5pass" name="md5pass" value="" autocomplete="off" /><div class="reg_btn clearfix"><span class="UIButton UIButton_Green UIFormButton"><input value="Sign Up" type="submit" class="UIButton_Text" onclick="return run_with(this, ["reg-util"], function() {RegUtil.getInstance().ajax_validate_data({ignore: ['captcha']}, "registration_container", "1");});" /></span>
pls help me:$
I use VB 2008
and i tired
.InvokeMember("submit")
System.Windows.Forms.SendKeys.Send("ENTER")
but doesnt work.
many thanks
Quote:
Originally Posted by
luke18
Hi! kleinma pls help me i try to make an autosubmit program for this website:
www.facebook.com
for the reg form.but i try many way for clicking the submit(Sign Up) button but i cant do it...could u help me??
I try .InvokeMember("submit")
System.Windows.Forms.SendKeys.Send("ENTER")
but it doesnt work:S
I use vb 2008, pls help me:/
many thanks!!
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Very intresting article, what about filling in Java textareas?
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hi ive used this thread to help me alot, when trying to get data from a web site for a internal system. ive now come across a problem which im a bit stuck on.
the site im working with isnt mine but a site we pay to use for data, on most of the pages i have mangaed to get the data or set or update fields but im having issues when trying to set the value on this box
SELECT class=userPerpage onchange=changeRecordsPerPage() name=pageSize><OPTION
value=10>10</OPTION> <OPTION value=25 selected>25</OPTION> <OPTION
value=50>50</OPTION> <OPTION value=100>100</OPTION></SELECT>
abi is the name of my web window
ABI.Document.All.Item("pageSize").InnerText = 50
also tried the innertext is quotes, i have also tried the following
ABI.Document.All.Item("pagesize").InvokeMember("click")
any ideas, many thanks
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
well i solved that problem, by doing this
ABI.Document.All("pagesize").SetAttribute("value", "50")
simple once i found it out
i now have another issue, the form has two buttons called go, crap i know.
this is the one i want to run
<INPUT class=button id=Save style="WIDTH: 30px" onClick="return validate('GO');" type=submit value=Go name=Go>
this is the one i dont want to run
<INPUT class=button id=searchButton onClick="return getQuickSearchProjectDetail();" type=button value=Go name=Go>
can you refer to the id as i see one is called searchbutton and the other is called save, i had tried just running the javacode but that didnt work
thanks im running vb2008
-
Re: Manipulate/Change/Form Fill data in web pages using the Webbrowser control
Hi,
Please forgive my Ignorance here but I'm going to ask anyway!
I still don't see how this is going to log into a website that requires a username and password. I am trying to follow along with this thread but am still stuck.
I have made an App. to just store links User names and passwords to all the sites I go to (just like this one) and I thought it would be nice if I could login automatically. I would really appreciate some help.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
I have worked with this quite a bit. Its tricky
Basically I use
vb Code:
PA="the URL"
WebBrowser1.navigate (PA)
Then in
vb Code:
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If URL = FP & "/" Then 'notice that you may have to check if the end back slash is there, it isn't always. Also, this procedure is fired a couple of times and you need to check to see what page is being completed.
Do Until pDisp Is WebBrowser1.object
Loop
If Username.Text > "" And Password.Text > "" Then
With WebBrowser1.Document
.All("USERNAME").Value = Username.Text
.All("PASSWORD").Value = Password.Text
'.All("Submit").Click
'.All("ENTER").submit
'.Forms(0).submit 'Use this to submit the info if the
'one above it doesn't work.
.myform.submit
' myform is the name of the form on the webpage,
'if you use the ones above, they may not work
'and the third one seems to fire all the submits on the page.
'You'll have to see which one works for each site
End With
call subroutine 'to parse whatever you want.
End if
Interestingly, in the parsing arena, I have noticed that if I parse
WebBrowser1.Document.body.innerText or WebBrowser1.Document.body.innerHTML
on my desktop I get
<INPUT value=6598 type=hidden name=CRN10><INPUT value=2802123 type=hidden name=CARRYUNAME>
but when run on other computers (all running XP sp2 and above, some Vista)
<INPUT type=hidden value=6598 name=CRN10><INPUT value=2802123 type=hidden name=CARRYUNAME>
Notice that the type attribute is switched. I have no idea why but it cost me alot of time to figure it out. I basically have to check and see which one is returned.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Would you mind posting a sample App?
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hello kleinma..
I've read a couple pages back and read that you were making a new example code for VS 2008. I wonder if you have finished it? Because I've checked the 2005 version and I think I could be really helped if it was on 2008 :blush:
I successfuly work out some part of it btw :)
Thanks
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Thanks, im glad I found this. Auto completing web forms is something im really interested in.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hi Kleinma,
if ur still following this thread... plz.. need ur help.... :confused:
not sure if this is where I should post :o but this quite similar to what i need.
so here it is:
i have a web application (using vs2008), the user will enter his username and password and a message and click on the submit button.
once the submit button is clicked, i need to open up a url in-memory (something like behind the scenes) without using the webbrowser control. once the url is opened, fill in the username and password supplied in my page, and submit the page, get the response, open a link which is in the page, which will redirect to a new page say page2.aspx, there i have a textbox for entering the message, i input the message the user entered in my application and then click the submit button in the page2.aspx, after clicking the button the page is posted and a message is displayed in a label in the page2.aspx which i need to capture and display it in a label on my application. then close the request that i made.
please help me with some sample code or point me in the direction i need to go in.. or some existing threads.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Easiest way is to use the code above I provided on Dec 17. Also note that my code doesn't always work but I commented out the other methods for submitting. Use the webbrowser control just don't show it or move it off screen.
You have to parse out the "link which is in the page" by using something like
InStr(1, WebBrowser1.Document.body.innerHTML, "courier") to find the position of the word "courier". Then its just a matter of widdling it down to get your URL. You can use a second webbrowser to launch the new link and so on.
Note: Allow time for the page to load, use a timer control (or if you are using a separate webbrowser for each new run, you can use the webbrowser.documentcomplete function.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hi CAVU,
Thanks for the quick response.. but i guess.. yours is a windows app rite.. :confused: i need it for a web app. :o
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
i hope u you upload vb.net 2008 version soon, been waiting for that release
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hi Klein,
I am trying to make an Image Downloader. Your app on this post no.1 is got all the features that I need but I am using VB 2010.
Can you please make something in this version???
Thanks in advance,
Trusted
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Opening the sln file in VS2010 will convert it to that version. No need to post new code.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
this is exactly what im looking for but i cant open your attachment :-/ and iv got VS2010
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
wow... that was nice kleinma
I think u can help me here, i'm trying to make a similar app :
http://www.vbforums.com/showthread.p...getelementbyid
let me give u a quick overview
1. i open a url, search a particular text in a textbox on it (basically a ticket #)
2. when the search result loads the tkt # disaplayed will contain a link to open the ticket , i need to send "click" to this (open the link)
3. after the ticket is opened i need to send some data to combo boxes & textboxes
i have already done steps 1 & 3 but stuck @ step # 2 since the elementid of the search result is always going to vary, i tried it with a fixed ticket # & worked fine, how do i achieve step # 2 ?
this will save lot of my time with some repetitive tasks, pls help !
p.s. - i'm using VS2005
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Thanks very much for the info on this thread. I have learned much since finding it. Below is a line of HTML found in the current webpage that is giving me no small amount of 'heardburh'.
This line appears as the third (i think .item(2)) of the page. I am trying to invoke using 'click' as you do, but this is not a button. When rendered in the webbrowser control it appears to be a submit button, but, as you see, it is not.
(HTML element:
<input type="image" name="loginPrimeAccess" src="/images/btn_go_to_primeaccess_BEC0C2.gif" border="0" tabindex="3"><br>
In the code below I have commented out the TRY in order to see the error message.
Here is the code I have so far:
Dim s As IHTMLElement
Me.Browser.Document.GetElementsByTagName("Input").Item(0).SetAttribute("Value", "037882")
Me.Browser.Document.GetElementsByTagName("Input").Item(1).SetAttribute("Value", "atrium")
s = Me.Browser.Document.GetElementsByTagName("image").Item(1)
'Try
Me.Browser.Document.GetElementsByTagName("image").Item(2).InvokeMember("Click")
'Catch
'End Try
How can I get the login to go?
Thanks,
Gary
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Quote:
Originally Posted by
paxmanhorn9
Thanks very much for the info on this thread. I have learned much since finding it. Below is a line of HTML found in the current webpage that is giving me no small amount of 'heardburh'.
This line appears as the third (i think .item(2)) of the page. I am trying to invoke using 'click' as you do, but this is not a button. When rendered in the webbrowser control it appears to be a submit button, but, as you see, it is not.
(HTML element:
<input type="image" name="loginPrimeAccess" src="/images/btn_go_to_primeaccess_BEC0C2.gif" border="0" tabindex="3"><br>
In the code below I have commented out the TRY in order to see the error message.
Here is the code I have so far:
Dim s As IHTMLElement
Me.Browser.Document.GetElementsByTagName("Input").Item(0).SetAttribute("Value", "037882")
Me.Browser.Document.GetElementsByTagName("Input").Item(1).SetAttribute("Value", "atrium")
s = Me.Browser.Document.GetElementsByTagName("image").Item(1)
'Try
Me.Browser.Document.GetElementsByTagName("image").Item(2).InvokeMember("Click")
'Catch
'End Try
How can I get the login to go?
Thanks,
Gary
Hi Gary,
Im glad you have found this thread useful, would you be able to tell me what Webpage your trying to login to so i can take a better look?
Thanks
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
The site is www.MyMls.com
Thanks,
Gary
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Klein just i want an advise which i worried from many days
is it possible to extract the data from a web page (.do file) to a data table
page contains a table
and the name of the person,USERid,statement period
any advise please
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
i tried to do the submit button but it doesnt work because the source page doesn't have the submit button name or ID. can someone help me.
<td>
<label class="uiButton uiButtonConfirm" for="u847036_3">
<input value="Login" tabindex="4" type="submit" id="u847036_3" />
</label>
</td>
Code:
DirectCast(GetCurrentWebForm.item("Login", 0), mshtml.HTMLButtonElement).click()
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
NVM
I got it
GetCurrentWebForm.submit()
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
I have a new issue. I show you the source code and my VB 2008 code. Basically I'm following what I did in my previous test to make it to work, however this website is more tricky. If someone could help me it would be great.
<div>
<span class="req">Posting Title:</span><br>
<input class="req" tabindex="1" type="text"
name="U2FsdGVkX18xNzU1MTE3NY6yhOpP3KeiEsxnPNFPyI1_AiYA:ILvewO7Kx_XF:D_4OTEL2-L5vlxg"
id = "U2FsdGVkX18xNzU1MTE3NY6yhOpP3KeiEsxnPNFPyI1_AiYA:ILvewO7Kx_XF:D_4OTEL2-L5vlxg"
size="30" maxlength="70"
value="">
</div>
DirectCast(GetCurrentWebForm.item("U2FsdGVkX18xNzU1MTE3NY6yhOpP3KeiEsxnPNFPyI1_AiYA:ILvewO7Kx_XF:D_4 OTEL2-L5vlxg"), mshtml.HTMLTextAreaElement).value = txtData.Text
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
The web site www.evony.com triggers the DocumentComplete event 5 times!
how can this be?