Jump to content

Another webpage autofill issue


Recommended Posts

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. 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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. 

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