Click here to Skip to main content
15,910,877 members
Please Sign up or sign in to vote.
2.25/5 (4 votes)
See more:
Hello,

I am currently developing a Software for my clients who can free of charge order a SIMCARD using my affiliate rights, and I am trying to develop a application that can help me with that.
I have very little knowledge about c# programming, but I attempted to do my first project, and I am learning it slowly, so here is my question to all those PROFESSIONALS out there.

I need to Automatically Fill in the following webform:


https://leadintelligence.co.uk/register/314/70/234/?sourceData=TopCashBack&sourceAffiliateId=null&



1. Fill the Webform with the provided
"First Name,          using TextBox1"  SAMPLE FIRSTNAME:(SAMPLE1)
"Last Name,           using TextBox2"  SAMPLE LASTNAME: (SAMPLE2
"Email,               using TextBox3"  SAMPLE EMAIL:    (abcde@acdb.com)
"Address Line 1,      using TextBox4"  SAMPLE ADDRESS:  (abcdesf)
"Postcode,            using TextBox5"  SAMPLE POSTCODE: (OX1 4AS)

-----------------------------------------------------------------
2. Click on "Find Address Button"
Then a small Multiline Window opens and I must select the address
that has been found and the correct House Number. I would like to
Automatically select the 2nd line with a checkbox in the future.
-----------------------------------------------------------------
3. Choose address/acddress-Line and Press "Select" Button.

5. Press "Send me My Free Sim".

I would appreciate any help or for those out there that find this a piece of cake, and could help me Autofill in this form and with one click submit this form as well.

..............................I SEEM TO NOT BE ABLE TO UPLOAD THE SOURCE CODE OF THE APPLICATION ON HERE..............

Maybe you could just look at the website i provided and tell me the ways of GetElementsByTagName from it.
Posted
Updated 31-Oct-11 4:47am
v4
Comments
RaisKazi 31-Oct-11 9:53am    
Your entire post is not very clear. If you just want to know about how to use "GetElementsByTagName" then refer below link.
http://www.w3schools.com/jsref/met_doc_getelementsbytagname.asp
procruzer 31-Oct-11 10:23am    
I updated the post, but unfortunatelly can not upload the source code on here. Would you be able to help me GetElementsByTagName from the website i provided, and the sample names and postcodes i put there? If i have your email address, i can send you the source code.
Menon Santosh 31-Oct-11 13:03pm    
Do want to fill the form programmaticly ?, if So i can help U
procruzer 31-Oct-11 14:31pm    
if anyone of you can email me, i can then explain how i wanted the form to be filled in programatically.
[no name] 31-Oct-11 23:09pm    
The purpose of asking a question here was to receive and answer here. Don't ask to have it sent to your email. Share the answer and knowledge with all.

I have not visited the site, nor will I, or most people here. However, you don't need to fill-in a webform to submit data. In general when a submit button is clicked a HTTP POST is send to the server with the data from the form fields encoded into it.

http://msdn.microsoft.com/en-us/library/debx8sh9.aspx[^]
 
Share this answer
 
Comments
procruzer 31-Oct-11 14:28pm    
For those of you who do not trust the Link i have provided, and i do not blame you, i fully understand.
Alternatevelly you can open the same form using the www.giffgaff.com website, and there click on "Order a free SIM" which is a major Network Provider in the Uk run by o2.
[no name] 31-Oct-11 23:10pm    
You do not need to fill in a form to submit the data.
procruzer 1-Nov-11 19:49pm    
Then why don't you post here the solution if you say that there is no need to fill in the form to submit the data? I am a complete beginner, i have never in my live coded anything, and i got behind it for a few hours and i got the solution i think at least.
[no name] 1-Nov-11 20:06pm    
You have been given a link that show exactly how to POST data to a url. I don't need to post anything.

Rather than getting angry because you don't understand it, try to learn.
I think Watin Core library will be helpful for you......
 
Share this answer
 
1st option:
I have found some way to fill the forms i asked all of you professionals out there. In the meantime, i researched it myself and found GetElementsById.

wb.Document.GetElementById("q_772_2_answer").SetAttribute("value", textBox5.Text);

wb.Document.GetElementById("q_772_3_answer").SetAttribute("value", textBox4.Text);

wb.Document.GetElementById("q_773_answer").SetAttribute("value", textBox10.Text);

wb.Document.GetElementById("q_774_userAddress").SetAttribute("value", textBox9.Text);

wb.Document.GetElementById("q_774_userPostcode").SetAttribute("value", textBox7.Text);

wb.Document.GetElementById("q_774_lookup").InvokeMember("click");


---------------------------------------------------------------------------------
2nd option:

HtmlElementCollection tags = wb.Document.Body.GetElementsByTagName("input");
foreach (HtmlElement t in tags)
if (t.GetAttribute("name").Equals("first_name"))
{
t.SetAttribute("value", "value of First Name");
}

foreach (HtmlElement t in tags)
if (t.GetAttribute("name").Equals("last_name"))
{
t.SetAttribute("value", "value of last name");
}
foreach (HtmlElement t in tags)
if (t.GetAttribute("name").Equals("email_address"))
{
t.SetAttribute("value", "value of email address");
}
foreach (HtmlElement t in tags)
if (t.GetAttribute("name").Equals("userAddress"))
{
t.SetAttribute("value", "value of Address");
}
foreach (HtmlElement t in tags)
if (t.GetAttribute("name").Equals("userPostcode"))
{
t.SetAttribute("value", "value of last name");
---------------------------------------------------------------------------------
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900