Jump to content
Sign in to follow this  
whanenbu

IE _IEGetObjById Textinput invalid

Recommended Posts

whanenbu

Issue: I found I can set the value but it is not accepted.

Code:

$oIE = _IEAttach ("https://www.collateraldna.com/forms/default.aspx", "URL")

$oDiv = _IEGetObjById ($oIE, "APPRAISER")

$oDiv.value = "Me"  This works

_IEAction($oDiv, "click") Result 0 but does nothing

_IEAction($oDiv, "focus") Result 2 ($_IEStatus_COMError) - COM Error in Object reference

From IE F12 See in red

<input name="APPRAISER" class="TextInput invalid" id="APPRAISER" aria-describedby="ui-tooltip-439" style="width: 301px; border-top-width: 1px; border-right-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-left-style: solid;" type="text" value="" validate="true">

What happens, on the screen I click on the field, enter "Me", click off the field and the textinput turns to valid.  I can add the text input by the .value but I can not get it to be accepted.  I can't get the click does not go anywhere and focus gives me the error.  How do I put in the value and then get it to validate????  Somehow I need it to execute.  

post-2959-0-90680800-1408940094_thumb.jp

Share this post


Link to post
Share on other sites
Inververs

You need dispatch KeyboardEvent for this input. And if validation occurs when focus out, you need init on blur event too.

Click events tab in debug pannel, its show all listened events.

Share this post


Link to post
Share on other sites
DaleHohm

You can also use .fireEvent method to to trigger arbitrary events.  Search the forum or see IE.au3 source to see how it is done.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites
whanenbu

$oIE = _IEAttach ("https://www.collateraldna.com/forms/default.aspx", "URL")

$oDiv = _IEGetObjById ($oIE, "APPRAISER")

_IEAction($oDiv, "focus")
 ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "Me", 1)
 ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{TAB}")
 Sleep(50 )

This seems to work but not totally accurate but mostly. 

This is faster:

$oSubmit = _IEGetObjById ($oIE, "APPRAISER")

_IEAction($oSubmit, "focus")
$oSubmit.value = "Me" & " "
ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{BS}")
ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{TAB}")
Sleep( 50 )

I added a space and then sent a backspace to remove it and then a tab to get off the variable which triggered the validation.

I sent _IEAction( $oSubmit, "blur") but that did not seem to do anything.  I will try the .fireevent.

Thanks 
 

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  

×