Jump to content

General ie.au3 help


Recommended Posts

I need help with 3 things using the include ie.au3

Sorry I am still learning autoit, any help would be appreciated.

1. I need to click on an image that is coded like this:

<a id="ContentPlaceHolder_ShoppingCartControl_click1" class="click2" href="java script:__doPostBack('ctl00$ContentPlaceHolder$ShoppingCartControl$click3','')">
        <div>clickme</div>

This is a .gif image if it helps but you can't right click on the page and get the file name.

2. This needs to be able to input data in this form field

<input name="ctl00$ContentPlaceHolder$SecurityCodeTextBox" type="text" maxlength="4" id="ctl00_ContentPlaceHolder_SecurityCodeTextBox" class="register" autocomplete="off" style="width:64px;" />

3. This needs to click a button

<input type="submit" name="ctl00$ContentPlaceHolder$enterButton" value="enter" id="ctl00_ContentPlaceHolder_enterButton" class="enterbutton" />
Link to comment
Share on other sites

  • Moderators

This should give you a good starting point.

#include <IE.au3>

; The URL of your web page
$sURL = "http://somewebpage.com"

; Prevent COM errors from terminating the script
_IEErrorHandlerRegister()

; Create an internet explorer object
$oIE = _IECreate($sURL)

; Get reference to the anchor via its id
$oLink = _IEGetObjById($oIE, "ContentPlaceHolder_ShoppingCartControl_click1")

; Perform a click event on the link
_IEAction($oLink, "click")

; Get reference to the form object containing the input and submit button
$oForm = _IEFormElementGetObjByName($oIE, "Form Name Value")

; Get reference to the input via the form object and the inputs name property
$oInput = _IEFormElementGetObjByName($oForm, "ctl00$ContentPlaceHolder$SecurityCodeTextBox")

; Set a new value for the input object
_IEFormElementSetValue($oInput, "Some Value")

; Perform a submit action on the form object
_IEFormSubmit($oForm)
Link to comment
Share on other sites

--> IE.au3 V2.3-1 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidObjectType

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

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

any ideas?

could be related to the $oForm = _IEFormElementGetObjByName($oIE, "Form Name Value")

I don't know what value would state the "form name value"

Tried both in the box below w/ no avail but I am sure those aren't correct

<div id="ctl00_ContentPlaceHolder_CreditCardInfoPanel">
<div class="section">

And is there anyway I can tell it to use the current webpage I have open instead of opening up a new one? I think somehow you use the _IEAttach but I don't know how to incorporate it correctly.

Link to comment
Share on other sites

And I tried aspnetform for $oForm = _IEFormElementGetObjByName($oIE, "Form Name Value")

It also didn't work

<form name="aspnetForm" method="post" action="Order.aspx" onsubmit="java script:return WebForm_onsubmit();" id="aspnetForm">

Link to comment
Share on other sites

  • Moderators

See if this gives better results.

#include <IE.au3>

; The URL of your web page
$sURL = "http://somewebpage.com"

; Prevent COM errors from terminating the script
_IEErrorHandlerRegister()

; Attach to an existing or create a new internet explorer object
$oIE = _IECreate($sURL, 1)

; Get reference to the anchor via its id
$oLink = _IEGetObjById($oIE, "ContentPlaceHolder_ShoppingCartControl_click1")

; Perform a click event on the link
_IEAction($oLink, "click")

; Wait for the web page to finish loading
_IELoadWait($oIE)

; Get reference to the form object containing the input and submit button
$oForm = _IEFormElementGetObjByName($oIE, "aspnetForm")

; Get reference to the input via the form object and the inputs name property
$oInput = _IEFormElementGetObjByName($oForm, "ctl00$ContentPlaceHolder$SecurityCodeTextBox")

; Set a new value for the input object
_IEFormElementSetValue($oInput, "Some Value")

; Perform a submit action on the form object
_IEFormSubmit($oForm)
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...