Jump to content
newscripter

Problem with finding objects after going to next IE page

Recommended Posts

newscripter

Hi all,

I am trying to find an object using a function which i also use earlier in the script. This time however, it does not work. Can anyone help me? The last command does not work.

#RequireAdmin
#include <IE.au3>
#include <Array.au3>
global $url="https://bestellen.dominos.nl/eStore/nl/CustomerDetails/Delivery"
Local $browser = _IECreate($url)
_IELoadWait($browser)

local $txt=_IEGetObjByID($browser,"customer-postcode")
_IEFormElementSetValue($txt,"9712gr")

local $txt2=_IEGetObjByID($browser,"customer-street-no")
_IEFormElementSetValue($txt2,"1")
_IEFormSubmit($browser,$txt2)
global $button=_IEGetObjById($browser,"order-time-button")
_IEAction($button, "click")
_Ieloadwait($browser)
global $button2=_IEGetObjById($browser,"store-result btn next")
_IEAction($button, "click")

 

Edited by newscripter

Share this post


Link to post
Share on other sites
Danyfirex

You can't because that button has not id just classname. I made a simple funtion for get the object by classname.

 

#RequireAdmin
#include <IE.au3>
#include <Array.au3>
Global $url = "https://bestellen.dominos.nl/eStore/nl/CustomerDetails/Delivery"
Local $browser = _IECreate($url)
_IELoadWait($browser)

Local $txt = _IEGetObjById($browser, "customer-postcode")
_IEFormElementSetValue($txt, "9712gr")

Local $txt2 = _IEGetObjById($browser, "customer-street-no")
_IEFormElementSetValue($txt2, "1")
_IEFormSubmit($browser, $txt2)
Global $button = _IEGetObjById($browser, "order-time-button")
_IEAction($button, "click")
_IELoadWait($browser)

Local $oBtnNextRetult=_GetObjByClass($browser, 'store-result btn next')

_IEAction($oBtnNextRetult, "click")
_IELoadWait($browser)



Func _GetObjByClass($oIE, $sClassName)
    Local $oaTags = _IETagNameGetCollection($oIE, "a")
    Local $oResutlt = 0
    For $oaTag In $oaTags
        If $oaTag.classname = $sClassName Then
            $oResutlt = $oaTag
            ExitLoop
        EndIf
    Next
    Return $oResutlt
EndFunc   ;==>_GetObjByClass

Saludos

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

×