Jump to content

Forms and moving elements in IE


Recommended Posts

I'm looking to manipulate a certain button on a webpage (form element name = button1). There are two buttons on the page (the other is form element name = button2). Each individual button appears in one of two forms (form name = formtop or formbottom). The buttons appear randomly in the forms, they aren't specific to a certain form. ie. button1 can appear in formtop the first time the page loads, and then button1 can appear in formbottom the next time the page loads. Here is what I have tried:

$oFrame = _IEFrameGetObjByName($oIE, "frame")
    $oForm1 = _IEFormGetObjByName($oFrame, "form1")
    $oForm2 = _IEFormGetObjByName($oFrame, "form2")
    $oButton = _IEFormElementGetObjByName($oForm1, "button1")
    if @error Then
        $oButton = _IEFormElementGetObjByName($oForm2, "button1")
    EndIf
    _IEAction($oButton, "click")

AutoIt gives me an _IEStatus_NoMatch error, but that's all. Help?

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Your logic looks sound. Are you getting just a single NoMatch or are you getting more than one? I would expect more than one based on your symptoms.

You may want to examine the contents of _IEBodyReadHTML($oFrame) to insure it is what you expect. You sould also look at $oForm1.innerHTML and $oForm2.innerHTML to see if you see the button definition in one of them as expected.

Without a real URL out HTML source there is little more to be offered.

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 NoMatch's are significant and their affect will cascade through your code as you are are trying to find objects nested in objects that you didn't successfully attach to...

So, follow my other suggestions with examining the HTML, because that is the source of your trouble.

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

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