jkuzo Posted September 7, 2007 Posted September 7, 2007 I am looking to automate the input of 400+ users into a webform which has to be done one user at a time. I have each field defined into an excel spreadsheet. The fields will be First Name Last Name and email address. After inputting an add button has to be pushed. Can anyone guide me in the right direction in pulling the names from the corresponding fields and inputting them into the web site, pushing add, waiting for the page to reload, and then going down to the next name on the spread sheet?
ssubirias3 Posted September 7, 2007 Posted September 7, 2007 One idea would be to store the information into a 2d array like $aUsers[400][3] and using either the IE.au3 or HTTP.au3 UDF (user defined function) and loop through the array. The command from the IE.au3 UDF could be _IEFormElementSetValue(). The following is from the Help file provided with AutoIt. ; ******************************************************* ; Example 2 - Get a reference to a specific form element and set its value. ; In this case, submit a query to the Google search engine ; ******************************************************* ; #include <IE.au3> $oIE = _IECreate ("http://www.google.com") $oForm = _IEFormGetObjByName ($oIE, "f") $oQuery = _IEFormElementGetObjByName ($oForm, "q") _IEFormElementSetValue ($oQuery, "AutoIt IE.au3") _IEFormSubmit ($oForm)Your loop might look something like this. Note I haven't tested this and it will probably need tweaking to make you a happy camper. ;; using $aUsers[400][3] as your data source ;; $aUsers[0][0] = "FName" ;; $aUsers[0][1] = "LName" ;; $aUsers[0][2] = "Fname.LName@company.org" For $i = 0 To UBound($aUsers, 1) - 1 For $j = 0 To UBound($aUsers, 2) - 1 _IEFormElementSetValue($oQuery, $aUsers[$i][$j]) Send("{TAB}") ;; <-- tab to next field Next _IEFormSubmit($oForm) Next Again I'm not sure if it will work, I'm just throwing out some ideas for you. Hope this helps.
DaleHohm Posted September 7, 2007 Posted September 7, 2007 Also look for LocoDarwin's ExcelCOM UDF (not part of the standard distribution) for reading from your Excel sheet. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now