Auto filling HTML Page using C#  
Author Message
prayag





PostPosted: Internet Explorer Extension Development, Auto filling HTML Page using C# Top

Hi,

I am developing an IE plugin which will auomatically provide
username and password to web pages on click of a button. I was trying
to develop a dummy button to test the approach and am trying to use
HTMLInputElementClass. The code compiles well but gives a run time
exception in the browser. the code goes like :

private void bttnEnterUserName_Click(object sender, EventArgs e)

{

HTMLDocumentClass doc = new HTMLDocumentClass();

doc = (HTMLDocumentClass) this.Explorer.Document;

HTMLInputElementClass ele = new HTMLInputElementClass();

if (doc.url.ToString() == "https://www.google.com/accounts/ServiceLogin service=mail&passive=true&rm=false&continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3Dhtml%26zy%3Dl&ltmpl=cm_blanco&ltmplcache=2")

{

foreach (HTMLInputElementClass element in doc.getElementsByTagName("input"))

{

ele = (HTMLInputElementClass) element.getAttribute("Email", 0);

element.value = "prayag.narula";

}

}

}

what am i doing wrong. Wat other aproach can i use




Internet Explorer Development7  
 
 
xRuntime





PostPosted: Internet Explorer Extension Development, Auto filling HTML Page using C# Top

Well, first off, it would help if you told us what the exception you recieved was.


 
 
prayag





PostPosted: Internet Explorer Extension Development, Auto filling HTML Page using C# Top

Well, actually I wanted to know if whatever I have being doing is the right way of going about it or not. I've seen various posts which nearly made me believe that HTMLInputElement is better off being used in .NET 1.1 and not in 2.0.

Now the exception I've got seems pretty vague to me :

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {3050F2AB-98B5-11CF-BB82-00AA00BDCE0B} failed due to the following error: 80040154.
at tempPcardToolBar1.UserControl1.bttnEnterUserName_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
tempPcardToolBar1
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/tempPcardToolBar1/1.0.0.0__464f5d0a5bdbcc52/tempPcardToolBar1.dll
----------------------------------------
BandObjectsLib
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/BandObjectsLib/1.0.0.0__ffdc4657f9a00288/BandObjectsLib.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Interop.SHDocVw
Assembly Version: 1.1.0.0
Win32 Version: 1.1.0.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Interop.SHDocVw/1.1.0.0__ffdc4657f9a00288/Interop.SHDocVw.dll
----------------------------------------
Microsoft.mshtml
Assembly Version: 7.0.3300.0
Win32 Version: 7.0.3300.0
CodeBase: file:///C:/WINDOWS/assembly/GAC/Microsoft.mshtml/7.0.3300.0__b03f5f7f11d50a3a/Microsoft.mshtml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT de**** registered on the computer
rather than be handled by this dialog box.

Tell me if this is the right way or if there is an alternate way of going about things..