Jump to content

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


Klexen
 Share

Recommended Posts

#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)

Link to comment
Share on other sites

#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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

#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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
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

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...