|
-
Jun 19th, 2007, 10:37 AM
#1
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
well are you planning on making a windows forms app in VB.NET that will host a webbrowser control? If so then this sounds easy to do. If you are actually trying to automate an external instance of internet explorer, then that will be more difficult. I know you used to be able to create external instances of IE and automate them, but I think support for that has dropped.
Anyway, so if you wanted to make a windows app that hosts the browser control (which is what my example code does) then here are a few key points to keep in mind:
When you navigate to a page, you need to wait for the DocumentCompleted event to fire. This event fires when the page has been fully loaded in the browser. Unlike the navigated event which fires as soon as a navigation has started.
You don't need to send tabs and keystrokes to the webpage when you use the methods shown in my example code. You simply access the pages DOM (document object model) and fill in the needed fields, and click the needed buttons/links.
The only one of your points I am not sure of is number 3? What do you mean by echoing? Does the page post back to the server on every keystroke entered? Is that why you need the wait?
-
Jun 19th, 2007, 11:09 AM
#2
New Member
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
I have created a form with buttons to activate individual scripts. Simply I have to log onto many different secure websites at the same time in order to perform different task as part of my employment. Remembering all my usernames and passwords, plus constantly logging on and off website is frustrating. Hence the Form I am creating. Eventually as my experience and knowledge improves. I would like to auto fill the from on these websites from a database, as a lot of my work is repetitive.
The echoing. The script only has "a" as a keystroke followed by a wait of 500ms before the next keystroke. But the username field may display multiple "a". But this problem does not seem to occur when I am connect to a high speed broadband.
If you are able to provide a basic code to which I can model from and/or improve it would be much appreciated
It is now 0200hrs here in Aussie, Thus I must get some shut eye
Thanks
//Gibbo
-
Jun 27th, 2007, 07:07 AM
#3
New Member
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hi guys. I've read throught this whole thread and I'm hoping you can help me. What I'm trying to do is automate a batch load process we have for our case tracking system. Basicily we have a website internal to our company that we go to and input the filename. You then click submit and it's done.
So I downloaded the OP's webmanipulate program and got it work well. But when I tried to use the code into my project, it didn't seem to work. It kept getting a repeating error of sorts. So I tried other methods mentioned on this page. The only method I got to somewhat work is:
Browser.Document.Forms(0).GetElementsByTagName("Input").Item(0).SetAttribute("Value", "test1")
The result of this is that it puts "test1" is put into a text box, but not the right one. I tried adjusting the Item number but it didn't work. I could only get it to put the text in the top text box (which is a search bar thats a standard part of our company's intranet).
So here's the html code for the page which I got permission to post with some editions:
Code:
<html>
<head>
<title>Merckury Batch Load Upload Page</title>
<script type="text/javascript">
var portallastmod='3 Mar 2005'
var portalcontact='[email protected]'
</script>
<meta name="Language" content="English language" />
<meta name="Sensitivity_class" content="Business confidential" />
<script src="/scripts/wrapperadd.js" type="text/javascript"></script>
<script src="/scripts/portaldefaults.js" type="text/javascript"></script>
<link href="/merckury/styles/batchload.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- This is the include for the header -->
<script type="text/javascript">portalInsertHeader()</script>
<!-- Begin Breadcrumb Strip -->
<div class="portalbreadcrumb">
<a href="http://my.merck.com/index.jsp?epi-content=myMerckRedirectType&epi-process=home_redirect.jsp">myMerck home</a> >
batch load cases
</div>
<!-- End Breadcrumb Strip -->
<div id="pagecontent">
<br/>
<br/>
<form name="fileUploadForm" method="post" action="/merckury/batchFileUploadRequest" ENCTYPE="multipart/form-data" >
<table width='600' border='0' cellpadding="1" cellspacing="1" align="center" bgcolor="#666666">
<tr>
<th>
Merckury Batch Load Upload Page
</th>
</tr>
<tr>
<td>
<table width="100%" cellpadding="5" cellspacing="0" border="0" bgcolor="white">
<tr>
<td>
<br/>
File Name: <input type="file" name="file1" size="80" />
<br/>
<br/>
<div align="center">
<input type="submit" name="submitButton" value="Submit"/>
</div>
</td>
</tr>
<tr>
<td>
<a href="BatchLoad.xls">Get the batch load spreadsheet</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<table width='600' border='0' cellpadding="1" cellspacing="1" align="center" bgcolor="#666666">
<tr>
<th>
Look up ID Values
</th>
</tr>
<tr>
<td>
<table width="100%" cellpadding="5" cellspacing="0" border="0" bgcolor="white">
<tr>
<td>
<a href="/merckury/batchIdLookup?lookuptype=0">Product IDs</a><br>
<a href="/merckury/batchIdLookup?lookuptype=1">Category / Specialty Type / Detail IDs</a><br>
<a href="/merckury/batchIdLookup?lookuptype=4">Provider Group IDs</a><br>
<a href="/merckury/batchIdLookup?lookuptype=5">Attribute IDs</a><br>
<br>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<script type="text/javascript">portalInsertFooter()</script>
</body>
</html>
As I said before I'm justing trying to input the filename (which is standard) and then click submit. My project has a browser in it called "browser" that navigates to the website when the form is loaded"
Also, for future refrence - is there a way to program a scan function to scan a website and display what the item numbers are? So basiclly after going to a website I would hit a "scan" button and it would look at the website and tell me the text boxes and gives me there form and item number. Would be helpful.
Any suggestions?
UPDATE: I've went back and modified the browser to use the testpage that came with OP program to see if it can populate any box after the first using the : Browser.Document.Forms(0).GetElementsByTagName("Input").Item(0).SetAttribute("Value", "test1")
method and ran into the same problem. Even though I added more lines with higher Item number, it just populated the first box (txtbox in this case). Hope someone can help.
Last edited by roiegat; Jun 27th, 2007 at 09:02 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|