Hello, I need help. I have the following code:
Code Copy
InternetExplorer IE = new InternetExplorer();Code Copy
object o = null;Code Copy
object misValue = System.Reflection.Missing.Value;Code Copy
HTMLDocument HTMLDoc = new HTMLDocumentClass();Code Copy
URL = "http://www.google.com";Code Copy
//Navigates to siteCode Copy
IE.Navigate(URL,ref o, ref o, ref o,ref o);Code Copy
//Makes IE visibleCode Copy
IE.Visible = true;Code Copy
//Waits until IE doesn't load page
{
Application.DoEvents();Code Copy
} while (IE.ReadyState != SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE);Code Copy
HTMLDoc = (HTMLDocument)IE.Document;Code Copy
//Locates the element on web documentCode Copy
HTMLInputElement field = (mshtml.HTMLInputElement)HTMLDoc.all.item("q", 1);Code Copy
{
field.value = "1234"; //Sets value of fieldCode Copy
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
This code works perfectly for Google site.... However i don't need to fill Google forms. I need to fill 2 fields on this address:
https://www.zaba.hr/ebank/gradjani/Prijava
As you can see this is https site. I don't know if there is some connection with this code and https but when change my code with:
Code Copy
URL = "https://www.zaba.hr/ebank/gradjani/Prijava";
AND
Code Copy
HTMLInputElement field = (mshtml.HTMLInputElement)HTMLDoc.all.item("otp", 1); //Second field on form
try
{
field.value = "1234";
}
I get the following exception:
OBJECT REFERENCE NOT SET TO AN INSTANCE OF OBJECT
I don't know what am I going wrong :(
Please help me
Augustin Jianu10 reputationPosted Apr 21, 2010, 3:06 AM EDT
Then why don't you send directly a request to the script that is