Sign in to follow this  
Followers 0
Klexen

Help filling in a text box on cox's website.

9 posts in this topic

#include <IE.au3>
$sURL = "https://service.cox.com/profile/Login.do?TARGET=-SM-https://service.cox.com/billpay/AccountSummary.do"
$sUsername = "asd@asd.com"
$sPassword = "mypass"

$oIE = _IECreate($sURL)
$HWND = _IEPropertyGet($oIE, "hwnd")
WinSetState($HWND, "", @SW_MAXIMIZE)
_IEAction($oIE, "visible")
_IELoadWait($oIE)
$oIE = _IEAttach("Cox Communications Login")
$oForm = _IEFormGetCollection($oIE, 1)
$oUsername = _IEFormElementGetObjByName($oForm, "username")
$oPassword = _IEFormElementGetObjByName($oForm, "password")

_IEFormElementSetValue($oUsername, $sUsername)
_IEFormElementSetValue($oPassword, $sPassword)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#include <IE.au3>
$sURL = "https://service.cox.com/profile/Login.do?TARGET=-SM-https://service.cox.com/billpay/AccountSummary.do"
$sUsername = "asd@asd.com"
$sPassword = "mypass"

$oIE = _IECreate($sURL)
$HWND = _IEPropertyGet($oIE, "hwnd")
WinSetState($HWND, "", @SW_MAXIMIZE)
;~ _IEAction($oIE, "visible")
;~ _IELoadWait($oIE)
;~ $oIE = _IEAttach("Cox Communications Login")
;~ $oForm = _IEFormGetCollection($oIE, 1)
$oUsername = _IEGetObjByName($oIE, "username")
$oPassword = _IEGetObjByName($oIE, "password")

_IEFormElementSetValue($oUsername, $sUsername)
_IEFormElementSetValue($oPassword, $sPassword)
_IEImgClick($oIE,"https://service.cox.com/images/btn_Login.gif");I guess it could be done with _IEFormSubmit() as well but you'd need to use  _IEFormGetCollection($oIE, 0)

Edited by Nahuel

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This would also work. Your problem was the _IEformGetCollection. It returns a 0-based index. (there was no form #1)

#include <IE.au3>
$sURL = "https://service.cox.com/profile/Login.do?TARGET=-SM-https://service.cox.com/billpay/AccountSummary.do"
$sUsername = "asd@asd.com"
$sPassword = "mypass"

$oIE = _IECreate($sURL)
WinSetState($oIE, "", @SW_MAXIMIZE)
$oForm = _IEFormGetCollection($oIE, 0)
$oUsername = _IEFormElementGetObjByName($oForm, "username")
$oPassword = _IEFormElementGetObjByName($oForm, "password")
_IEFormElementSetValue($oUsername, $sUsername)
_IEFormElementSetValue($oPassword, $sPassword)
Edited by Brickoneer

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

#include <IE.au3>
$sURL = "https://service.cox.com/profile/Login.do?TARGET=-SM-https://service.cox.com/billpay/AccountSummary.do"
$sUsername = "asd@asd.com"
$sPassword = "mypass"

$oIE = _IECreate($sURL)
$HWND = _IEPropertyGet($oIE, "hwnd")
WinSetState($HWND, "", @SW_MAXIMIZE)
;~ _IEAction($oIE, "visible")
;~ _IELoadWait($oIE)
;~ $oIE = _IEAttach("Cox Communications Login")
;~ $oForm = _IEFormGetCollection($oIE, 1)
$oUsername = _IEGetObjByName($oIE, "username")
$oPassword = _IEGetObjByName($oIE, "password")

_IEFormElementSetValue($oUsername, $sUsername)
_IEFormElementSetValue($oPassword, $sPassword)
_IEImgClick($oIE,"https://service.cox.com/images/btn_Login.gif");I guess it could be done with _IEFormSubmit() as well but you'd need to use  _IEFormGetCollection($oIE, 0)
You rock dude, thanks! How would you click that login button? Edited by Klexen

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

No problem, but brickoneer's solution is better, IMO:

#include <IE.au3>
$sURL = "https://service.cox.com/profile/Login.do?TARGET=-SM-https://service.cox.com/billpay/AccountSummary.do"
$sUsername = "asd@asd.com"
$sPassword = "mypass"

$oIE = _IECreate($sURL)
WinSetState($oIE, "", @SW_MAXIMIZE)
$oForm = _IEFormGetCollection($oIE, 0)
$oUsername = _IEFormElementGetObjByName($oForm, "username")
$oPassword = _IEFormElementGetObjByName($oForm, "password")
_IEFormElementSetValue($oUsername, $sUsername)
_IEFormElementSetValue($oPassword, $sPassword)
_IEFormSubmit($oForm)

I hadn't noticed what he said. It's because I never use the _IEFormGetCollection() function, as you can see <_<

Edited by Nahuel

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

No problem, but brickoneer's solution is better, IMO:

#include <IE.au3>
$sURL = "https://service.cox.com/profile/Login.do?TARGET=-SM-https://service.cox.com/billpay/AccountSummary.do"
$sUsername = "asd@asd.com"
$sPassword = "mypass"

$oIE = _IECreate($sURL)
WinSetState($oIE, "", @SW_MAXIMIZE)
$oForm = _IEFormGetCollection($oIE, 0)
$oUsername = _IEFormElementGetObjByName($oForm, "username")
$oPassword = _IEFormElementGetObjByName($oForm, "password")
_IEFormElementSetValue($oUsername, $sUsername)
_IEFormElementSetValue($oPassword, $sPassword)
_IEFormSubmit($oForm)

I hadn't noticed what he said. It's because I never use the _IEFormGetCollection() function, as you can see <_<

Thanks man!

I just did this...

#include <IE.au3>
$sURL = "https://service.cox.com/profile/Login.do?TARGET=-SM-https://service.cox.com/billpay/AccountSummary.do"
$sUsername = ""
$sPassword = ""

$oIE = _IECreate($sURL)
$HWND = _IEPropertyGet($oIE, "hwnd")
WinSetState($HWND, "", @SW_MAXIMIZE)
_IEAction($oIE, "visible")
_IELoadWait($oIE)

$oForm = _IEFormGetCollection($oIE, 0)

$oUsername = _IEGetObjByName($oIE, "username")
$oPassword = _IEGetObjByName($oIE, "password")

_IEFormElementSetValue($oUsername, $sUsername)
_IEFormElementSetValue($oPassword, $sPassword)
_IEFormSubmit($oForm)
Edited by Klexen

Share this post


Link to post
Share on other sites

Just two things you should notice:

_IEAction($oIE, "visible")
_IELoadWait($oIE)

They are pointless. _IECreate() will wait until the page has loaded before returning, so there's no need for _IELoadWait() and it will always be visible unless you tell it to create it hidden. So _IEAction($oIE, "visible") does nothing because it's already visible.

Share this post


Link to post
Share on other sites

_IEFormSubmit() works most times, yes. Good job. However, sometimes you HAVE to click the button. You'll get some values of your input box and/or button by using the _IETagNameGetCollection() function.

$L_o_Inputs = _IETagNameGetCollection($L_oIE_CRU, "INPUT")
    $L_iInputCnt = @extended
    ConsoleWrite("Debug: Found " & $L_iInputCnt & " input tags" & @LF)
    Local $flagRFC = 0
    If $L_iInputCnt Then
        For $L_oInput In $L_o_Inputs
            If $L_oInput.name = "rfcrAmt"  And $flagRFC < 1 Then
                $L_oInput.value = $strRFCAmt
                ConsoleWrite("Debug: Updated RFCR Amt" & @LF)
                $flagRFC = 1
            EndIf
            If $L_oInput.type = "submit"  And $L_oInput.value = "Update"  Then
                ConsoleWrite("Debug: Found Update button" & @LF)
                _IEAction($L_oInput, "click")
                ExitLoop
            EndIf
        Next
    EndIf

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

@Nahuel - Thanks for the tip, it's been a force of habit to do it that way.

@Blue Drache - Thanks dude, that will really help in the future.

@Brickoneer - Thanks a lot for the help!

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