Jump to content

Recommended Posts

Posted

Hi ,

I am using AutoIt for web automation. I want to check some text displayed on the web page after an operation.

HTML Body control name is Internet Explorer_Server1 and I got the handler to this but when i call ControlGetText with this it is giving empty string.

But If use ControlClick ( $whandle,"", $hwnd , "right",1 ) it works fine.

Can any one help me.

Thanks

Regards

Sai Kumar

Posted

HTML Body control name is Internet Explorer_Server1 and I got the handler to this but when i call ControlGetText with this it is giving empty string.

As it seems, ControlGetText does not work with every control, as it obviously depends on the control if you can "extract" the text. It's easy for an edit Control (notepad). However, vim (another editor) uses it's own control to view and edit text (VimTextArea1). Using the "AutoIT Window Info" tool, I'm getting the following visible Window Text for

notepad: TEST MESSAGE 1 2 3

vim: Vim text area, Screollbar

I typed the same text into both editors. I guess it's the same for IE. You won't be able to get the text of a web page from "Internet Explorer_Server1".

Better use InetGet (see help) to retrieve a web page and parse that page for any

changes.

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Posted

Using 3.1.1++ you can use the COM interface and then use the DOM (Document Object Model) for IE to retrieve the text. I can't recite the correct object hierarchy off the top of my head because it always takes some messing around for me to get it right, but it can be 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

Posted

Using 3.1.1++ you can use the COM interface and then use the DOM (Document Object Model) for IE to retrieve the text.  I can't recite the correct object hierarchy off the top of my head because it always takes some messing around for me to get it right, but it can be done.

Dale

<{POST_SNAPBACK}>

Can u breif on this or quote with a small example .

How do i integrate a dll into autoit script

Posted

As it seems, ControlGetText does not work with every control, as it obviously depends on the control if you can "extract" the text. It's easy for an edit Control (notepad). However, vim (another editor) uses it's own control to view and edit text (VimTextArea1). Using the "AutoIT Window Info" tool, I'm getting the following visible Window Text for

  notepad: TEST MESSAGE 1 2 3

  vim: Vim text area, Screollbar

I typed the same text into both editors. I guess it's the same for IE. You won't be able to get the text of a web page from "Internet Explorer_Server1".

Better use InetGet (see help) to retrieve a web page and parse that page for any

changes.

Cheers

Kurt

<{POST_SNAPBACK}>

Can u tell me some thing abt vim. Is it a tolol to find windo info.
Posted

Can u breif on this or quote with a small example .

How do i integrate a dll into autoit script

<{POST_SNAPBACK}>

Here's an example. It shows you the text on the www.amazon.com page. There are tons of properties for the document object... Google search or use MSDN for more info. Also search these forums for InternetExplorer.Application for a lot more examples.

$ObjIE=ObjCreate("InternetExplorer.Application")

With $ObjIE
  .Visible = True
  .Navigate("http://www.amazon.com")
  Do
    Sleep(50)
  Until .ReadyState = 4
EndWith

$theText = $ObjIE.document.body.outertext

ConsoleWrite($theText)

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

  • 9 months later...
Posted

Opt('WinTitleMatchMode', 2)

$w = WinGetHandle('Internet Explorer')

while ControlGetFocus($w) <> 'Internet Explorer_Server1'

ControlFocus($w, '', 'Internet Explorer_Server1')

wend

ControlSend($w, '', 'Internet Explorer_Server1', '^a^c')

Sleep(3000) ;can probably reduce this

MsgBox(48, 'Internet Explorer_Server1 Text', ClipGet())

exit

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...