Jump to content
puttwill

Another webpage autofill issue

Recommended Posts

puttwill

I'm sorry for posting about yet another web page with auto fill issues. I've made autoit's for a few webpages and thought i had it down, but this one is causing me lots of issues. I've been working on this on and off for a few weeks and can't seem to solve it. If any one could help that would be great. My main issue is there is no form name. I'm quite sure i need to use $oForm = _IEFormGetCollection ($oIE, 0) but it keeps returning $_IESTATUS_NoMatch. I've tried 0-10 but no match. It's the 1st element i'm trying so it should be 0. There are no frames. All the posts i've seen on this all say to check for frames and then stops there. No frames on this one. Here is the code. I've taken on large chunks of options on the drop down list on element 2 and 3 to save space.....

<div id="insideHeader" class="bottomHeader clearfix">
             <div id="ticketStatusWrapper" class="alignLeft" style="margin-top: 5px;">
                        <div class="ie-inline">
                            <span class="label10px" style="margin-left: 15px;">Ticket Number</span>
                            <input type="text" class="ie-inline width175px input10px alignCenter" id="headerT" placeholder="Ticket Number" maxlength="15">
                            <!--[if IE 8]><div id="headerCountrySelect" class="ie-inline"><![endif]-->
                            <span id="headerCountryLabel" class="label10px" style="margin-left: 8px;">Country</span>
                            <select id="headerTicketCountry" class="ie-inline width175px select10px">
                                <option value="">Select Country</option>
                                <option value="Afghanistan">Afghanistan</option>
                            ****DELETED A BUNCH***
                                <option value="Zimbabwe">Zimbabwe</option>
                            </select>
                            <!--[if IE 8]></div><![endif]-->
                            <!--[if IE 8]><div id="headerStateSelect" class="ie-inline"><![endif]-->
                            <span id="headerStateLabel" class="label10px" style="margin-left: 8px;">State</span>
                            <select id="headerTicketState" class="ie-inline width175px select10px">
                                <option value="" selected>Select State</option>
                                <option value="AL" prefix="WAL">Alabama</option>
                            ****DELETED A BUNCH***
                                <option value="WY" prefix="null">Wyoming</option>
                            </select>
                            <!--[if IE 8]></div><![endif]-->
                            <button type="submit" id="headerViewStatus" class="ie-inline btn btn-sm btn-blue ie7-btn" ticketElem="headerT" countryElem="headerTicketCountry" stateElem="headerTicketState" style="margin-left: 10px;">
                                View Status
                            </button>
                        </div>
                    </div>
                </div>

Thanks. 

Share this post


Link to post
Share on other sites
MikahS

Please, post your AutoIt code as well. So, that we may help with that script.


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites
puttwill

Mikahs, as I haven't gotten pasted the $_IESTATUS_NoMatch I have almost no code written. So far I just have...

#include <ie.au3>
$oIE = _IECreate ("https://expressticketing.acss.att.com/expressticketing/"
$oForm = _IEFormGetCollection ($oIE, 0)

If i get passed the mismatch I was going to try....

$oQuery1 = _IEGetObjById ($oForm, "headerT")
_IEAction($oQuery1, "focus")
Send("TM072247")

Danp2, It's the only thing I can find when inspecting the elements that deals with the form I'm trying to auto fill. If you want view the original page its...

https://expressticketing.acss.att.com/expressticketing

Share this post


Link to post
Share on other sites
MikahS

You'll most likely need to account for each area you want to interact with, since there is not a form in the HTML.

I would use _IETagNameGetCollection to get all the "headerT" elements. Then loop through these, and enter your information.


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites
Danp2

There's no form on that page, which explains why _IEFormGetCollection is returning $_IESTATUS_NoMatch. o:)

Do NOT use Send! You should be able to interact with the input fields using _IEGetObjById and _IEFormElementSetValue. You can access the button using _IEGetObjById and then use _IEAction to perform the click.

Share this post


Link to post
Share on other sites
puttwill

Thanks for pointing me in the correct direction for this. I got the 1st input box sorted out. The below code is how I got it to work. The next step is to set the state before click view status(btw Mikahs you don't need an account to view the status). When I stepped through all of the ID's with _IETagNameGetCollection, "headerT showed up, but the state ID "headerTicketState" did not show up. Any thoughts on how I can get the state ID to show up now? 

 

#include <ie.au3>

$oIE = _IECreate ("https://expressticketing.acss.att.com/expressticketing/")
$hWnd = _IEPropertyGet($oIE, "hwnd")

$oButtons = _IETagNameGetCollection ($oIE, "input")

For $oButtons In $oButtons
    If $oButtons.ID = "headerT" Then
       _IEAction($oButtons, "focus")
       ControlSend($hWnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "Ticket#")
Else
EndIf
Next

 

Share this post


Link to post
Share on other sites
Danp2

Not sure why you are using hwnd, ControlSend, and looping through a collection. :ermm:

Do NOT use Send! You should be able to interact with the input fields using _IEGetObjById and _IEFormElementSetValue. You can access the button using _IEGetObjById and then use _IEAction to perform the click.

​Here's how I would do it using this earlier hint:

#include <ie.au3>

Local $oIE = _IECreate ("https://expressticketing.acss.att.com/expressticketing/")

Local $input = _IEGetObjById($oIE,  "headerT")
_IEAction($input, "focus")
_IEFormElementSetValue($input, "123456")

Local $select = _IEGetObjById($oIE,  "headerTicketState")
_IEFormElementOptionSelect($select, "FL")

Local $button = _IEGetObjById($oIE,  "headerViewStatus")
_IEAction($button, "click")

 

Share this post


Link to post
Share on other sites
puttwill

Wow. That's ridiculously easier. I tired figuring out what to do with _IEGetObjById but failed horribly. Looks so simple seeing an example. Works perfect for headerT but like my other code, totally fails for headerTicketState and headerViewStatus

Share this post


Link to post
Share on other sites
Danp2

I'm confused by your last post. Are you saying that the last script I posted isn't working for you?

If so, please run it in Scite and then post the Output window results here.

Share this post


Link to post
Share on other sites
puttwill

The script DOES put the ticket number in the "headerT" box. The script does NOT change the state in "headerTicketState" and does NOT click the View Status button IDed as headerViewStatus.

Please forgive my newbieness in regards to your request to run in "Scite." I'm thinking you mean run it in the editor that comes with AutoIt where the window says "Scite-Lite" at the top and has an output window at the bottom. Here is the output of that window with your script....

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "U:\autoit scripts\escalate ticket\express.au3"    
>Exit code: 0    Time: 22.34

There are no errors. It's like is just doesn't see "Local $select = _IEGetObjById($oIE,  "headerTicketState")". Thanks all your help. 

Share this post


Link to post
Share on other sites
Danp2

Strange... it worked when I tested it here. Please tell us more about your environment (versions of OS, IE, AutoIt, etc).
P.S. You can download the full SciTE package here.

Share this post


Link to post
Share on other sites
puttwill

I am running IE 8 for various reasons. That could be why. 

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

×