IEFormFill Not Working

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
PaulSR
Pro Scripter
Posts: 65
Joined: Mon Aug 05, 2013 2:58 pm
Location: Edinburgh/Peterborough

IEFormFill Not Working

Post by PaulSR » Thu Sep 12, 2013 9:30 am

Hi,

This is using Macro Scheduler 14 PRO v14.0.13

Today I've started playing with WebRecorder but I've fallen at the first hurdle as for some reason it won't populate fields on IE with IEFormFill. This is what I did :

1. Launch WebRecorder from within macro scheduler.
2. Launch http://www.google.com.
2. Click on the search box.
3. Type "Macro Scheduler 14" into the search box

Close the WebRecorder software using the "X" button in the top-right.

Attempt to execute code - it gets as far as opening the IE window and loading the google page but no text reaches the form.

I've attached the generated code below - what stood out to me is that every time I fill the form I get two identical lines of code inserted (this may be normal I don't know). Also, whilst within the webrecorder clicking the "RUN" button returns an error stating "Unable to locate Macro Scheduler, make sure it is installed." but I don't know if that's related. Seems strange given I've launched WR from MS and when I quite WR the code is carried back to MS.

Anybody got any idea?

Here's the generated code :


// Generated by MacroScript WebRecorder 4.01
// Recorded on Thursday, September 12, 2013, at 10:23 AM

//Move the mouse cursor out of harm's way to avoid causing mouseover events to interrupt
MouseMove>0,0
Let>delay=1

//Enable automatic downloads to My Documents dir, modify path if required
IEOnDownload>1,,ie_res

//Set timeout for ClickTag and FormFill to 10 seconds, increase if pages load more slowly
IESetTimeout>10,ie_res

IECreate>IE[0]

IENavigate>%IE[0]%,http://www.google.com/,ie_res

IEWaitDocumentComplete>%IE[0]%,ie_res

IEClickTag>%IE[0]%,{""},{"f"},{"INPUT"},{"ID"},{"lst-ib"},ie_res

IEFormFill>%IE[0]%,{""},{"f"},{"q"},{"Macro Scheduler 14"},0,ie_res

IEFormFill>%IE[0]%,{""},{"f"},{"q"},{"Macro Scheduler 14"},0,ie_res

IEClickTag>%IE[0]%,{""},{"f"},{"BUTTON"},{"CLASSNAME"},{"lsb"},ie_res

IEWaitDocumentComplete>%IE[0]%,ie_res



Many thanks in advance,

Paul.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Sep 12, 2013 12:23 pm

Google's main search page is tricky - it changes the page as soon as you click in or modify the search box.

Instead you can use the advanced page:
http://www.google.com/advanced_search

Or, just construct the URL with the search term to navigate straight to the results without filling any form:

Code: Select all

Let>url=https://www.google.com/?q=apples#q=apples
IECreate>ie_ref
IENavigate>ie_ref,url,ie_res
IEWaitDocumentComplete>ie_ref,ie_res
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

PaulSR
Pro Scripter
Posts: 65
Joined: Mon Aug 05, 2013 2:58 pm
Location: Edinburgh/Peterborough

Post by PaulSR » Thu Sep 12, 2013 12:34 pm

Thanks - switching to the advanced search did indeed work; However I've just tried the site i'm interested in and it doesn't work on that either - is there something about specific pages that means they won't work?

Here's the code for that page - no details are keyed into the username/password areas.



IESetTimeout>10,ie_res

IECreate>IE[0]

IENavigate>%IE[0]%,https://premiumfinance.laseruk.com/default.aspx,ie_res

IEWaitDocumentComplete>%IE[0]%,ie_res

IEClickTag>%IE[0]%,{""},{"ACTION:Account/Login.aspx"},{"INPUT"},{"ID"},{"MainContent_LoginUser_UserName"},ie_res

IEFormFill>%IE[0]%,{""},{"ACTION:Account/Login.aspx"},{"ctl00$MainContent$LoginUser$UserName"},{"MyUserNameGoesHere"},0,ie_res

IEClickTag>%IE[0]%,{""},{"ACTION:Account/Login.aspx"},{"INPUT"},{"ID"},{"MainContent_LoginUser_Password"},ie_res

IEFormFill>%IE[0]%,{""},{"ACTION:Account/Login.aspx"},{"ctl00$MainContent$LoginUser$Password"},{"MyPasswordGoesHere"},0,ie_res

IEClickTag>%IE[0]%,{""},{"ACTION:Account/Login.aspx"},{"BUTTON"},{"ID"},{"MainContent_LoginUser_LoginButton1"},ie_res
IEFormSubmit>%IE[0]%,{""},{"ACTION:Account/Login.aspx"},ie_res

IEWaitDocumentComplete>%IE[0]%,ie_res

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Sep 12, 2013 12:46 pm

Try replacing:

ACTION:Account/Login.aspx

With nothing.

It might just be that WebRecorder has used the Action of the form to identify it but this is different at playback. Assuming this is the only form or the form elements are unique to this form you can safely remove the form identifier (empty string) and it should still find the elements.

So your code becomes:

Code: Select all

IECreate>IE[0]
IENavigate>%IE[0]%,https://premiumfinance.laseruk.com/default.aspx,ie_res
IEWaitDocumentComplete>%IE[0]%,ie_res
IEClickTag>%IE[0]%,{""},{""},{"INPUT"},{"ID"},{"MainContent_LoginUser_UserName"},ie_res
IEFormFill>%IE[0]%,{""},{""},{"ctl00$MainContent$LoginUser$UserName"},{"MyUserNameGoesHere"},0,ie_res
IEClickTag>%IE[0]%,{""},{""},{"INPUT"},{"ID"},{"MainContent_LoginUser_Password"},ie_res
IEFormFill>%IE[0]%,{""},{""},{"ctl00$MainContent$LoginUser$Password"},{"MyPasswordGoesHere"},0,ie_res
IEClickTag>%IE[0]%,{""},{""},{"BUTTON"},{"ID"},{"MainContent_LoginUser_LoginButton1"},ie_res
IEFormSubmit>%IE[0]%,{""},{""},ie_res

IEWaitDocumentComplete>%IE[0]%,ie_res
WebRecorder is only an *aid* and has to make some assumptions which aren't always correct. Modifications to the code are sometimes required.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

PaulSR
Pro Scripter
Posts: 65
Joined: Mon Aug 05, 2013 2:58 pm
Location: Edinburgh/Peterborough

Post by PaulSR » Thu Sep 12, 2013 1:10 pm

Thanks again :D I was just about to try doing it with a mixture of WR and MS code but that's proving tricky too (it had all been going so well). I'll bear your advice in mind and give your suggestion a go just now.

PaulSR
Pro Scripter
Posts: 65
Joined: Mon Aug 05, 2013 2:58 pm
Location: Edinburgh/Peterborough

Post by PaulSR » Thu Sep 12, 2013 1:14 pm

Yep that's solved that problem - thanks very much.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts