C
cweeks
I am using the Webbrowser control in VS 2005 C# Express to automate the
navigation of pages on a partner's web site. The first page contains
an <IFRAME> element:
<iframe style='width:40; height:40'; align='center' marginwidth='0'
marginheight='0'
scrolling='no' frameborder='0' id='xyzlogin' name='xyzlogin'
src='https://www.xyzcorp.com/accounts/ServiceLogin'>
</iframe>
Within that frame I need to access these three elements:
<input type="text" name="Email" value="" class="xyz le val" id="Email"
size="18">
<input type="password" name="Passwd" class="xyz le val" id="Passwd"
size="18">
<input type="submit" name="null" value="Sign in" class="xyz le button"
so I can programmatically: 1)enter the user ID and password, 2)click
the 'Sign in' button.
I thought maybe Webbrowser.Document.Window.Frames would be the way to
go but that did not seem to work (sorry, I'm not at my development
environment right now or I would provide more detail).
Frames is an HtmlWindowCollection. An HtmlWindow has a Document member
which is an HTMLDocument. So, would this work:
-Look through the Frames collection until a HtmlWindow named 'xyzlogin'
is found.
-Get the Document member for that window and extract the following
HTMLElements by ID: Email, Passwd.
-Set the InnerText properties for these elements.
-Find the button element (how? it does not have a valid name or id)
-Use InvokeMember("Click") to click the button.
navigation of pages on a partner's web site. The first page contains
an <IFRAME> element:
<iframe style='width:40; height:40'; align='center' marginwidth='0'
marginheight='0'
scrolling='no' frameborder='0' id='xyzlogin' name='xyzlogin'
src='https://www.xyzcorp.com/accounts/ServiceLogin'>
</iframe>
Within that frame I need to access these three elements:
<input type="text" name="Email" value="" class="xyz le val" id="Email"
size="18">
<input type="password" name="Passwd" class="xyz le val" id="Passwd"
size="18">
<input type="submit" name="null" value="Sign in" class="xyz le button"
so I can programmatically: 1)enter the user ID and password, 2)click
the 'Sign in' button.
I thought maybe Webbrowser.Document.Window.Frames would be the way to
go but that did not seem to work (sorry, I'm not at my development
environment right now or I would provide more detail).
Frames is an HtmlWindowCollection. An HtmlWindow has a Document member
which is an HTMLDocument. So, would this work:
-Look through the Frames collection until a HtmlWindow named 'xyzlogin'
is found.
-Get the Document member for that window and extract the following
HTMLElements by ID: Email, Passwd.
-Set the InnerText properties for these elements.
-Find the button element (how? it does not have a valid name or id)
-Use InvokeMember("Click") to click the button.