Sign in to follow this  
Followers 0
dar100111

No error finding _ieformelement in console but won't set value

5 posts in this topic

#1 ·  Posted (edited)

I am able to find this element

<input name="NO" onkeyup="this.value = this.value.toUpperCase();" onkeypress="IsEngorInt(event)" type="text" size="20" maxlength="12" value=""/>

From my Code below. There's no error finding the $input or formname either. I made sure my $masterbill is pulling ok too, with the msgbox. Has anyone ran into any issues like this? Thanks! Also curious how everyone pastes their code on the message boards where it can be scrolled through. I've just been pasting the text.

#include <IE.au3>

#include <Excel.au3>

#include <Array.au3>

$row = 3

$value = InputBox("Steam Vessel Tracking Script", " ENTER ACTION TO PERFORM"&@lf&@LF&"1. Track Shipments"&@lf&"2. Input CFIT Information"&@lf&"3. "&@lf&"4. "&@lf&" ", "*", " M1")

If @error = 1 Then Exit; Cancel button pressed

$oExcel = _ExcelBookOpen("F:EIDFWNATOracle NMCNMC DevelopmentNetwork AnalystReportsautoitSteam Trac Tool.xlsx")

$aArray = _ExcelReadSheetToArray($oExcel)

$counter = $aArray[0][0]

$oIE = _IECreate("http://www.shipmentlink.com/servlet/TDB1_CargoTracking.do",0,1,1)

If $value = 1 Then

Do

$masterbill = $aArray[$row][1]

$oForm = _IEFormGetObjByName($oIE, "frmCargo");enter the form id or name

$input = _IEFormElementGetObjByName($oForm, "NO")

MsgBox("", "", $masterbill)

_IEFormElementSetValue($input, $masterbill)

#include <IE.au3>

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

For $oButton In $oButtons

If String($oButton.type) = "button" Then

; Save the current element to a variable

$oButton2Save = $oButton

; Exit the for loop now that we have found the go button

ExitLoop

EndIf

Next

_IEAction($oButton2Save, "click")

_IELoadWait($oie)

$row = $row + 1

_IENavigate($oIE, "http://www.shipmentlink.com/servlet/TDB1_CargoTracking.do",1)

_IELoadWait($oie)

Until $row = $counter + 1

MsgBox("","Information Gathered", "All Shipments Tracked")

EndIf

Edited by dar100111

Share this post


Link to post
Share on other sites



$input = _IEFormElementGetObjByName($oForm, "NO", 5)

Your code was working, but it was populating the first box in the "multiple tracking" tab, as that was the first match in the source.

Share this post


Link to post
Share on other sites

Great that works. I'm dumbfounded because I went back and looked at the HTML, how did you know it was the 5th instance? I used the selector tool with IE and I really couldn't tell.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Looking at the page source there are five (name="NO") before the one you wanted (instances 0-4)

<input type="text" name="NO" size="16" maxlength="12" value="" onKeyPress="IsEngorInt(event)" onKeyUp="this.value = this.value.toUpperCase();">&nbsp;
<input type="text" name="NO" size="16" maxlength="12" value="" onKeyPress="IsEngorInt(event)" onKeyUp="this.value = this.value.toUpperCase();">&nbsp;
<input type="text" name="NO" size="16" maxlength="12" value="" onKeyPress="IsEngorInt(event)" onKeyUp="this.value = this.value.toUpperCase();">&nbsp;
<input type="text" name="NO" size="16" maxlength="12" value="" onKeyPress="IsEngorInt(event)" onKeyUp="this.value = this.value.toUpperCase();">&nbsp;
<input type="text" name="NO" size="16" maxlength="12" value="" onKeyPress="IsEngorInt(event)" onKeyUp="this.value = this.value.toUpperCase();">&nbsp;&nbsp;
Edited by danwilli

Share this post


Link to post
Share on other sites

Again thanks for you help Dan! You rock!

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  
Followers 0