Hello, I need help. I have the following code:
InternetExplorer IE = new InternetExplorer();
string URL;
object o = null;
object misValue = System.Reflection.Missing.Value;
HTMLDocument HTMLDoc = new HTMLDocumentClass();
URL = "http://www.google.com";
//Navigates to site
IE.Navigate(URL,ref o, ref o, ref o,ref o);
//Makes IE visible
IE.Visible = true;
do
//Waits until IE doesn't load page
{
Application.DoEvents();
} while (IE.ReadyState != SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE);
HTMLDoc = (HTMLDocument)IE.Document;
//Locates the element on web document
HTMLInputElement field = (mshtml.HTMLInputElement)HTMLDoc.all.item("q", 1);
try
{
field.value = "1234"; //Sets value of field
}
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:
//Wanted URL
URL = "https://www.zaba.hr/ebank/gradjani/Prijava";
|
AND
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 JianuPosted Apr 21, 2010, 7:06 AM
Then why don't you send directly a request to the script that is