Jump to content

Click buttons in IE.


Recommended Posts

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

Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
Share on other sites

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