Jump to content

Why Can't I Obtain Text Sometimes From A WEB Page


Recommended Posts

I would like to understand why when I execute:

#include <IE.au3>

$oIE_form = _IE_Example ("form")

$MyObject = _IEGetObjByName ($oIE_form, "textExample")

$MyText = $MyObject.innerText

MsgBox(0, "", $MyText)

and this is "textExample":

<td>&lt;input type='text' name='textExample' value='http://' size='20' maxlength='30'&gt;</td>

I do not obtain the "http://".

But!! When I execute:

#include <IE.au3>

$oIE_form = _IE_Example ("form")

$MyObject = _IEGetObjByName ($oIE_form, "textareaExample")

$MyText = $MyObject.innerText

MsgBox(0, "", $MyText)

and this is "textareaExample":

<td>&lt;textarea name='textareaExample' rows='5' cols='15'&gt;Hello!&lt;/textarea&gt;</td>

I do obtain "Hello".

What seems inconsistent to me is that if I store a string in $MyText ($MyText.innerText = "Howdy") in both examples above it does work ?!

Thanks

Edited by GreekGeek
Link to comment
Share on other sites

The string displayed in an INPUT TYPE=TEXT element is it's "value" property, not it's innerText. TextArea does use innerText (the text between the opening tag and the closing tag of the element.

If you use the form element value property, you'll see that the DOM adds the consistency you are looking for. Using the IE.au3 function:

$MyText = _IEFormElementGetValue($MyObject)

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

Link to comment
Share on other sites

The string displayed in an INPUT TYPE=TEXT element is it's "value" property, not it's innerText. TextArea does use innerText (the text between the opening tag and the closing tag of the element.

If you use the form element value property, you'll see that the DOM adds the consistency you are looking for. Using the IE.au3 function:

$MyText = _IEFormElementGetValue($MyObject)

Dale

Thanks for the help Dale.

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