Jump to content
Sign in to follow this  
wysocki

_IEFormSubmit gives "JavaScript is disabled..." msg in IE

Recommended Posts

wysocki

I'm trying to submit a form from a user/password page and having problems. If I'm not logged in, Yahoo gives me a login screen. There is a form where I enter username and password and click the submit button. It obviously works manually and my code below nicely fills in the username and password. But the _IEformSubmit() makes the page come back with the error "Javascript is disabled in your browser. Please enable Javascript and try to log in again." I BELIEVE it already IS enabled in my browser but not exactly sure where to check. Anyway, I was looking at _IEattach() and it says "if the window contains a control called "Internet Explorer_Server1" then you can attach to it with this function", which it does. However, I'm not sure just WHERE to put the _IEattach() since it returns another $oIE handle.

Is _IEattach() the answer to my login problem and if so, how do I implement it in this code?

#include <IE.au3>
#include <IE_V1Compatibility.au3>
$oIE = _IECreate("https://login13.marketingsolutions.yahoo.com/")
If StringInStr(_IEBodyReadText($oIE), "Forgot your password") Then;handle login screen if it comes up
   $oForm = _IEFormGetObjByName($oIE, "loginForm")
   $oField = _IEFormElementGetObjByName ($oForm, "uname")
   _IEFormElementSetValue($oField,"myname")
   $oField = _IEFormElementGetObjByName ($oForm, "pwd")
   _IEFormElementSetValue($oField,"mypassword")
   _IEFormSubmit($oForm)
EndIf

Share this post


Link to post
Share on other sites
DaleHohm

_IEAttach is not what you want.

DebugBar quickly showed me the source for the login button:

<INPUT id=loginButton type=image src="https://a248.e.akamai.net/sec.yimg.com/i/us/ypn/ms/adapp_1_8_1_0_7/images/login-btn.gif">

so, instead f _IEFormSubmit, use

$oLogin = $IEGetObjById($oIE, "loginButton")

_IEAction($oLogin, "click")

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

Share this post


Link to post
Share on other sites
wysocki

That worked, thanks for the help, Dale! I'm trying to automate some data retrieval from the marketingsolutions.yahoo.com website that I use for Yahoo Search Marketing account. They certainly know how to make it hard for me with Autoit. I know a bit about html and php, but they use ajax, iframes, and a bunch of techniques I never knew existed on their pages.

I got DebugBar and I'm trying to learn how to use it now with this website. Under the DOM tab, the body shows a bunch of IFRAMEs that have no name but do have an id. The same thing for the images, no names. The forms don't have names and they just popup when you click a link on the page. Very puzzling. I'm struggling now because I can't figure out how to "click" the various elements on the page. Can you recommend any place to go to learn how to use DebugBar to figure out how to control it with Autoit? Thanks again!

Share this post


Link to post
Share on other sites
DaleHohm

Hmmm... one suggestion is to make certain you notice the dropdownin the DebugBar toolbar to the right of the zoom selection dropdown and to the left of the eyeball... it allows you to see the source of the main document or any of the frame/iframes...

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×