Jump to content

IE.au3


Recommended Posts

This code works when the WebSite is http:

$webpagehttp = "www3.netbank.commbank.com.au/netbank/bankmain"

CODE
;Open Webpage

$oIE = _IECreate($webpagehttp)

_IELoadWait($oIE)

WinSetState($LogonScreen, "", @SW_MAXIMIZE)

If WinExists($LogonScreen) Then

Else

$message = " Site NOT AVAILABLE"

DisplayMessage()

Exit

EndIf

However some Internet Banking Logon Pages are "https" where the above code does not work.

Does anyone know the magic?

Ant..

Link to comment
Share on other sites

IE (having nothing to do with IE.au3) tries http:// by default -- you'll need to specify https:// in the URL if that is what you want (note that https:// sites often have a redirect from http:// to https:// and might confuse you about the behavior).

Dale

Edit: Typo - left out the "s" in https

Edited by DaleHohm

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

Link to comment
Share on other sites

IE (having nothing to do with IE.au3) tries http:// by default -- you'll need to specify http:// in the URL if that is what you want (note that https:// sites often have a redirect from http:// to https:// and might confuse you about the behavior).

Dale

You are correct it is a re-direct from a http page I have not been able to go to

the https page direct using the code previously published in this Support Item.

This variable https://ib.nab.com.au/nabib/index.jsp produces this result http://https/ in Internet Explorer and 'about:blank if I try to go to the page in ie7.

So my guess is that the solution is to call the http page first then use one of the _ie click

functions to launch the https page given that all the buttons are labled 'Go' I am not quite

sure which click function is the most appropriate to use.

Ant..

Link to comment
Share on other sites

You are correct it is a re-direct from a http page I have not been able to go to

the https page direct using the code previously published in this Support Item.

This variable https://ib.nab.com.au/nabib/index.jsp produces this result http://https/ in Internet Explorer and 'about:blank if I try to go to the page in ie7.

So my guess is that the solution is to call the http page first then use one of the _ie click

functions to launch the https page given that all the buttons are labled 'Go' I am not quite

sure which click function is the most appropriate to use.

Ant..

try _IEnavigate or something like:

$obj = _IEGetObjByName($oIE, "submit")
_IEAction($obj, "click")
_IELoadWait($oIE)
Link to comment
Share on other sites

I've looked at the site and my guess is that it is forcing you to get to the https site via the http site (by checking the referrer and taking you to about:blank if you try to go directly there). Note that the unique behavior you are seeing is due to coding on this site and is not related to IE.au3 or htttps in general.

I really can't tell what you are trying to do because the code you supply is incomplete, but I will suggest that you'll have trouble on a redirect page waiting for it to complete unless you add some more code.

You can simply add a Sleep after your _IECreate or you can add a loop checking _IEPropertyGet($oIE, " locationurl") for https:

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

Link to comment
Share on other sites

try _IEnavigate or something like:

$obj = _IEGetObjByName($oIE, "submit")
_IEAction($obj, "click")
_IELoadWait($oIE)
In view source I checked the name of the object which is "submit" however whilst this code opens the website the click action is not performed

CODE
#include <IE.au3>

$webpage = "http://www.nab.com.au/"

$Logonscreen = "National Australia Bank"

$oIE = _IECreate($webpage)

_IELoadWait($oIE)

WinSetState($LogonScreen, "", @SW_MAXIMIZE)

$oSubmit = _IEGetObjByName($oIE, "submit")

_IEAction ($oSubmit, "click")

_IELoadWait ($oIE)

Ant..
Link to comment
Share on other sites

I've looked at the site and my guess is that it is forcing you to get to the https site via the http site (by checking the referrer and taking you to about:blank if you try to go directly there). Note that the unique behavior you are seeing is due to coding on this site and is not related to IE.au3 or htttps in general.

I really can't tell what you are trying to do because the code you supply is incomplete, but I will suggest that you'll have trouble on a redirect page waiting for it to complete unless you add some more code.

You can simply add a Sleep after your _IECreate or you can add a loop checking _IEPropertyGet($oIE, " locationurl") for https:

Dale

Link to comment
Share on other sites

I've looked at the site and my guess is that it is forcing you to get to the https site via the http site (by checking the referrer and taking you to about:blank if you try to go directly there). Note that the unique behavior you are seeing is due to coding on this site and is not related to IE.au3 or htttps in general.

I really can't tell what you are trying to do because the code you supply is incomplete, but I will suggest that you'll have trouble on a redirect page waiting for it to complete unless you add some more code.

You can simply add a Sleep after your _IECreate or you can add a loop checking _IEPropertyGet($oIE, " locationurl") for https:

Dale

I am still working on enhancing he Virtual Keyboard which I previously published I want the user to be able to administer up to 24 sites that can be individually selected.

Once I get to the logon screen "user and password" everything else works just fine. Its the re-direct to https that has me foxed at the moment. The complexity is that not

all sites of interest actually involve a re-direct to https.

Ant..

Link to comment
Share on other sites

I'm guessing that you are getting some console messages that you have not shared.

Suggest you use _IEErrorHandlerRegister() so that you can trap errors if they are unhandled or check the return values of other functions so that you can retry.

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

Link to comment
Share on other sites

I'm guessing that you are getting some console messages that you have not shared.

Suggest you use _IEErrorHandlerRegister() so that you can trap errors if they are unhandled or check the return values of other functions so that you can retry.

Dale

Thanks for the suggestion

ant..

Link to comment
Share on other sites

Attached code works in the case of running $Ws = 1 or $Ws = 2.

In the case of $Ws = 3 does not work as I am getting an error reported as follows:

--> IE.au3 Warning from function _IEFormGetObjByName, $_IEStatus_NoMatch

--> IE.au3 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

--> IE.au3 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

--> IE.au3 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

--> IE.au3 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

I have checked the Source code for this Web page and I am pretty sure that the Form name I am using is correct.

I have also encounted the problem with www.nab.com.au as well as many other sites where the Form name identified in the Source code

simply results in the same error as for ANZ.

Any assistance as to how to remedy this error would be appreciated. This is the code that I have been using to test all the sites

of interest.

CODE
#include <IE.au3>

;Select site to process 1, 2 or 3

$Ws = 3

;Website Data

If $Ws = 1 Then

Global $Websites = "1 Commonwealth Bank:Netbank:www3.netbank.commbank.com.au/netbank/bankmain:Logon:Logon:LOGINFORM:USER_LOGON_NAME:PASSWORD:"

ElseIf $Ws = 2 Then

Global $Websites = "2 Westpac Bank:Online Banking:www.westpac.com.au:Westpac Internet -Personal Banking Homepage:Westpac online - Sign In:Form:uname:pwd:"

ElseIf $Ws = 3 Then

Global $Websites = "3 ANZ Bank:Internet Banking:www.anz.com.au:ANZ HomePage:ANZ Internet Banking - Logon:LogonForm:USERID:PIN:"

Else

MsgBox(0, "", "Change $Ws value to 1, 2 or 3")

EndIf

;Extract Data and assign variables

$split = StringSplit($Websites, ":", 0)

$Title = $split[2]

$webpage = $split[3]

$HomeScreen = $split[4]

$LogonScreen = $split[5]

$oFormName = $split[6]

$oUserName = $split[7]

$oPassword = $split[8]

$LoggedInScreen = $split[9]

;Launch Website and then User to open https Webpage where applicable

$oIE = _IECreate($webpage)

_IELoadWait($oIE)

WinSetState($HomeScreen, "", @SW_MAXIMIZE)

If WinExists($HomeScreen) Then

If $HomeScreen <> $LogonScreen Then

MsgBox(262144, $Title & "- Virtual Keyboard ", "Open Online/Internet Banking Then Click OK", 60)

EndIf

Else

$message = " Site NOT AVAILABLE"

DisplayMessage()

Exit

EndIf

;Pass data to Webpage

$oForm = _IEFormGetObjByName($oIE, $oFormName); Form Name

$oQuery = _IEFormElementGetObjByName($oForm, $oUserName); User ID Field

_IEFormElementSetValue($oQuery, "Input"); Input value

$oQuery = _IEFormElementGetObjByName($oForm, $oPassword); Password Field

_IEFormElementSetValue($oQuery, "*****"); Input value

;Message Box Subroutine

Func DisplayMessage()

SplashTextOn($Title & "- Virtual Keyboard", $message, 250, 50, 600, 500, 36, "times new roman", 10, 600)

Sleep(3500)

SplashOff()

EndFunc ;==>DisplayMessage

Link to comment
Share on other sites

The only time I have seen a valid call fail is when the HTML was invalid (would not pass the W3C validator). More likely, there is confusion with fames... don't know how you are checking the HTML source, but I suggest you use ConsoleWrite(_IEBodyReadHTML($oIE) & @CR) to insure you are not being fooled by a View Source... with frames.

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

Link to comment
Share on other sites

The only time I have seen a valid call fail is when the HTML was invalid (would not pass the W3C validator). More likely, there is confusion with fames... don't know how you are checking the HTML source, but I suggest you use ConsoleWrite(_IEBodyReadHTML($oIE) & @CR) to insure you are not being fooled by a View Source... with frames.

Dale

Ok I have put that in the code and got the report but unfortunately I do not know what I am looking for......???? Can you give me an example?????

Ant..

Link to comment
Share on other sites

You said you saw the form with the correct name in the source... did you see it in the output of that command? It shows you the source code in the body of $oIE

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

Link to comment
Share on other sites

You said you saw the form with the correct name in the source... did you see it in the output of that command? It shows you the source code in the body of $oIE

Dale

Hi Dale

What is always difficult is the language being used to describe what is going on. So I will try and describe to you what I have done hopefully in plain language. Ok when I ran option 1 "Commonwealth Bank" the routine opens a https page and the console report shows the name of the Form and the name for the user id and password everything matches off with the code that can be displayed using the Page/View Source option in Internet explorer. Westpac and ANZ I have not been able to get the script to open the HTTPS page so what the script does is open the http page and then the script has a delay in the MSGBOX statement and I am manually opening the HTTPS page before clicking on the OK button to allow the script to run on. The code in the Page/View Scource option in Internet explorer allowed me to Identify the name of the Form and Other Input fields of interest for Westpack. However the Console report for this procedure does not appear to compare with the Page/View Source code viewed in Internet explorer for the HTTPS page for both Westpac and the Anz so I am only guessing that what is being written to the console is the code for the HTTP page opened by the script not the HTTPS page which I have launched manually. From a scripting point of view I simply added the code you recommended as follows indicated by ****:

CODE
$oForm = _IEFormGetObjByName($oIE, $oFormName)

ConsoleWrite(_IEBodyReadHTML($oIE) & @CR); *******************************************************

$oQuery = _IEFormElementGetObjByName($oForm, $oUserName)

_IEFormElementSetValue($oQuery, "Input")

$oQuery = _IEFormElementGetObjByName($oForm, $oPassword)

_IEFormElementSetValue($oQuery, "*****")

I appreciate your responses which are providing direction rather than the exact solution which I like because that is the best way to learn. The fact that I my level of frustration has forced me to take a blood pressure tablet is nothing that you should be concerned or worry about.

What next?................

Cheers

Ant..

Link to comment
Share on other sites

Make certain that the ConsoleWrite is executed AFTER any redirects have completed.

If the output does not include the same output as the View Source then there are two likely issues - 1) there are FRAMES or iFRAMES involved or 2) there is Javascript involved which is dynamically changing the HTML. In the case of 2), the output from the ConsoleWrite is more accurate for your purposes than View Source. Issue 1 is much more likely.

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

Link to comment
Share on other sites

Make certain that the ConsoleWrite is executed AFTER any redirects have completed.

If the output does not include the same output as the View Source then there are two likely issues - 1) there are FRAMES or iFRAMES involved or 2) there is Javascript involved which is dynamically changing the HTML. In the case of 2), the output from the ConsoleWrite is more accurate for your purposes than View Source. Issue 1 is much more likely.

Dale

Thanks for your comments however I have not been able to progress any closer to a solution. Perhaps I need to go back a step and that is how to click on the 'log on' button on the www.anz.com.au HomePage. There are three Forms on this page one is called called 'login_form'

This code does not work.

#include <IE.au3>

$oIE = _IECreate("www.anz.com.au")

_IELoadWait($oIE)

WinSetState($HomeScreen, "", @SW_MAXIMIZE)

If WinExists($HomeScreen) Then

_IEFormImageClick ($oIE, "log on" , "alt")

Else

$message = " Site NOT AVAILABLE"

DisplayMessage()

Exit

EndIf

This solution could be one small step one giant leap etc etc

Ant..

Link to comment
Share on other sites

Thanks for your comments however I have not been able to progress any closer to a solution. Perhaps I need to go back a step and that is how to click on the 'log on' button on the www.anz.com.au HomePage. There are three Forms on this page one

This solution could be one small step one giant leap etc etc

Get the Form's object first. And post code that can actually be run:

#include <IE.au3>

$oIE = _IECreate("www.anz.com.au")
_IELoadWait($oIE)

$oForm = _IEFormGetObjByName($oIE, "login_form")

If IsObj($oForm) Then
    _IEFormImageClick($oForm, "log on", "alt")
    Sleep(2000)
    MsgBox(64, "Message", "I think I clicked on logon...")
Else
    MsgBox(16, "Message", 'Couldn not get "login_form" object.')
EndIfoÝ÷ Ù8ZµØmÂä²-®'jëh×6   _IEFormImageClick($oForm, "/common/img/buttons/b2_logon.gif", "src")oÝ÷ Ù8ZµØmÂäz+azµ¡jÙuè­ÂäÁ«,Â+)à¶"h'$jëh×6#include <IE.au3>

$oIE = _IECreate("www.anz.com.au")
_IELoadWait($oIE)

$oForm = _IEFormGetObjByName($oIE, "login_form")

If IsObj($oForm) Then
    _IEImgClick($oForm, "/common/img/buttons/b2_logon.gif", "src")
    Sleep(2000)
    MsgBox(64, "Message", "I think I clicked on logon...")
Else
    MsgBox(16, "Message", 'Couldn not get "login_form" object.')
EndIfoÝ÷ Ùhbr¥²(®K0ØZºÚ"µÍWÒQR[YÐÛXÚÊ   ÌÍÛÑÜK ][ÝÛÙÈÛ][ÝË  ][ÝØ[ ][ÝÊ

Problem solved...

:whistle:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...