Jump to content
Sign in to follow this  
Derk

Click buttons in IE.

Recommended Posts

Derk

I have a webpage that i am looking to click several buttons.

The first page has a new PO button with the ID of 'L_NewItem' and i am able to automate this, but when it goes to the second page to click Save and Close with the ID of 'L_NewFormSaveClose' i am unable to automate it. Here is the code. Do i need to put in an if then statement. You must excuse me as i am new to autoit and scripting. After this page there is an addtional field that is named Purchase Order No. that i would like to copy and paste into another application

#include <IE.au3>

$oIE =_IECreate("https://domain.com/C0/Purchase%20Order%20Number%20Generato/Lists/Purchase%20Order%20Number%20Generator/AllItems.aspx")

;New Po Number

$oNewPOBTN = _IEGetObjByName($oIE, 'L_NewItem')

_IEAction ($oNewPOBTN, "click")

;Save and Close Button

$osavclose = _IEGetObjByName($oIE, 'L_NewFormSaveClose')

_IEAction ($osavclose, "click")

Share this post


Link to post
Share on other sites
Derk

Can anybody give me some direction with this?

Share this post


Link to post
Share on other sites
Derk

So I had to add a _IELoadWait($oIE) in between.

No all i have to to is figure out how to copy the text from the PO field.

Share this post


Link to post
Share on other sites
Derk

I came up with this and it finds IPO but includes other text. I am trying to just have it copy the PO numbr "IPO000" for example.

;search the page

$sText = _IEBodyReadText ($oIE)

$aText = StringSplit($sText,@CRLF)

; Locate any text with IPO

For $x = 1 to $aText[0]

If StringInStr($aText[$x],"IPO") Then

msgbox(0,"",$aText[$x])

EndIf

Next

Share this post


Link to post
Share on other sites
PsaltyDS

There might be better ways to read the text you want. Since we don't see the HTML of the page you are working with, it's hard for us to see how to help. You might look at _IEPropertyGet() for the "innnerText" property. It depends on the specifics of the element you are reading.

Have you used a DOM Inspector like DebugBar on the page?

:)


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

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.