Sign in to follow this  
Followers 0
Lapo

Internet Explorer Click Submit Button

13 posts in this topic

#1 ·  Posted (edited)

Internet Explorer click SUBMIT button

the page : http://some.page.com/

the html : name=MM_insert> <INPUT type=submit value=Entra name=Submit>

I have tried with no luck :

#include <IE.au3>

$oIE = _IECreate()
$oIE.visible = 0
sleep(2000)
_IENavigate($oIE, "http://some.page.com/")

;;;_IENavigate($oIE, "C:\WINDOWS\TEMP\http://some.page.htm")

$oIE.visible = 1
sleep(200)
$oForm = _IEFormGetObjByName($oIE, "form1")
$oForm= _IEFormGetObjByIndex($oIE, 0)
$oQuery = _IEFormElementGetObjByName($oForm, "username")
$oQuery2 = _IEFormElementGetObjByName($oForm, "password")
$oButton = _IEFormElementGetObjByName($oForm, "Entra")

_IEFormElementSetValue($oQuery, "USER")
_IEFormElementSetValue($oQuery2, "PASS")
;_IEFormElementSetValue($oButton, "Submit")
Sleep(500)

;_IEClickImg($oIE, "Submit", "name", 0, 1)
;_IEClickLinkByText($oIE, "Submit", 0,  1)
;$oForm = _IEFormGetObjByName($oIE, "form1")
MsgBox(262144, "", _IEFormElementGetCount($oForm))
;MsgBox(262144, "",_IEFormElementGetCollection($oForm))
;_FWrite(@TempDir & "\tmp.tmp", _IEFormElementGetObjByName($oForm, "Submit", 0) )
_FWrite(@TempDir & "\tmp.tmp", _IEFormElementGetTypeByIndex($oForm, 0))
_FWrite(@TempDir & "\tmp.tmp", _IEFormElementGetTypeByIndex($oForm, 1))
_FWrite(@TempDir & "\tmp.tmp", _IEFormElementGetTypeByIndex($oForm, 5))
;$oForm= _IEFormGetObjByIndex($oIE, 0)
;MsgBox(262144, "", $oForm & @CRLF)
;$oButton = _IEFormElementGetObjByName($oForm, "Entra")
;
_IEFormSubmit($oForm)
;MouseClick("right", 571,532,"1",0)
Sleep(1500)
_IEFormSubmit("form1")

;$oForm = _IEFormGetObjByName($oIE, "form1")
;$oInputs = _IETagNameGetCollection($oForm, "login")
;$oInputs.item(0).click


Func _FWrite($temp1,$text)
$file = FileOpen($temp1, 1)
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
FileWrite($file, $text & @CRLF)
FileClose($file)
EndFunc
Edited by Lapo

Share this post


Link to post
Share on other sites



The button name is Submit (in the form). Try this -

This line: $oButton = _IEFormElementGetObjByName($oForm, "Entra") should be $oButton = _IEFormElementGetObjByName($oForm, "Submit").

Share this post


Link to post
Share on other sites

The button name is Submit (in the form). Try this -

This line: $oButton = _IEFormElementGetObjByName($oForm, "Entra") should be $oButton = _IEFormElementGetObjByName($oForm, "Submit").

This is correct, but then you want to use
$oButton.click
the form submit action often doesn't work because wide developers attach Javascript to the Submit button instead cf relying on a generic form submit action.

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

#4 ·  Posted (edited)

The button name is Submit (in the form). Try this -

This line: $oButton = _IEFormElementGetObjByName($oForm, "Entra") should be $oButton = _IEFormElementGetObjByName($oForm, "Submit").

Yes it works thanks

and this ? I have problems with the checkbox ... thank you

#include <IE.au3>
$oIE = _IECreate()
$oIE.visible = 0
;sleep(2000)
_IENavigate($oIE, "https://www.google.com/accounts/ManageAccount?service=mail&hl=it")
$oIE.visible = 1
sleep(1000)

$oForm= _IEFormGetObjByIndex($oIE, 0)
$oforms2 =_IEFormElementGetTypeByIndex($oForm,5)
;MsgBox(262144, "", $forms2)
$oQuery = _IEFormElementGetObjByName($oForm, "Email")
$oQuery2 = _IEFormElementGetObjByName($oForm, "Passwd")
;$oButton = _IEFormElementGetObjByName($oForm, "Entra")
$oConf = _IEFormElementGetObjByName($oForm, "rmShown")
;<input type="hidden" name="rmShown" value="1

_IEFormElementSetValue($oQuery, "MAIL")
_IEFormElementSetValue($oQuery2, "PASSSS")
;$indx = _IEFormElementGetObjByIndex($oForm, 5)
;MsgBox(262144, "", $indx)

_IEAction($oforms2,"focus")
_IEFormElementSetValue($oforms2, "1")
MsgBox(262144, "", _IEFormElementGetValue($oforms2))
Sleep(100)
Edited by Lapo

Share this post


Link to post
Share on other sites

Please see the pointer to a discussion of checkboxes and radio buttons at the end of the examples topic (reply 3 of the IE.au3 thread). They don't work the way you think they do.

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

This is correct, but then you want to use

$oButton.click
the form submit action often doesn't work because wide developers attach Javascript to the Submit button instead cf relying on a generic form submit action.

Dale

I was going to suggest that next. That's what you suggested to me when I had these issues, but I was curious to see if submit would work.

Share this post


Link to post
Share on other sites

Please see the pointer to a discussion of checkboxes and radio buttons at the end of the examples topic (reply 3 of the IE.au3 thread). They don't work the way you think they do.

Dale

Plus, I don't think that code goes with that website.. there is no form there.

Share this post


Link to post
Share on other sites

I was going to suggest that next. That's what you suggested to me when I had these issues, but I was curious to see if submit would work.

Ah, I'll sit on my hands a little longer next time :think:

I really appreciate to role you (and others) have taken recently in answering these questions.

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

Ah, I'll sit on my hands a little longer next time :think:

I really appreciate to role you (and others) have taken recently in answering these questions.

Dale

Well it really helps to have such a good teacher. I wouldn't have a clue if it weren't for all the work you've put in.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Please see the pointer to a discussion of checkboxes and radio buttons at the end of the examples topic (reply 3 of the IE.au3 thread). They don't work the way you think they do.

Dale

ahhh I get it thanks :

#include <IE.au3>
$oIE = _IECreate()
$oIE.visible = 0
sleep(2000)
_IENavigate($oIE, "https://www.google.com/accounts/ManageAccount?service=mail&hl=it")
$oIE.visible = 1


$oForm= _IEFormGetObjByIndex($oIE, 0)
$oforms2 =_IEFormElementGetTypeByIndex($oForm,4)
;MsgBox(262144, "", $forms2)
$oQuery = _IEFormElementGetObjByName($oForm, "Email")
$oQuery2 = _IEFormElementGetObjByName($oForm, "Passwd")
$oButton = _IEFormElementGetObjByName($oForm, "Entra")
$oConf = _IEFormElementGetObjByName($oForm, "PersistentCookie")
;<input type="hidden" name="rmShown" value="1

_IEFormElementSetValue($oQuery, "")
_IEFormElementSetValue($oQuery2, "")

    $oConf.checked = False
Edited by Lapo

Share this post


Link to post
Share on other sites

I was going to suggest that next. That's what you suggested to me when I had these issues, but I was curious to see if submit would work.

Yes it work

Share this post


Link to post
Share on other sites

Well it really helps to have such a good teacher. I wouldn't have a clue if it weren't for all the work you've put in.

I agree ... GREAT work

Share this post


Link to post
Share on other sites

I apreciate that guys. A sincere thank-you goes a long way.

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  
Followers 0