Jump to content

Click javascript button on webpage


Recommended Posts

I want to click on the link (java script:UpdateFramesExternal) below. This is the code in a frame name=mainleft.

I am new to scripting websites so I need some direction, or lots of documentation with examples to follow.

I tried this -- but no go.

$oFrame = _IEFrameGetObjByName($oIE,"mainleft")

;_IEFormElementGetObjByName($oFrame, "java script:UpdateFramesExternal('Encapsulations', false)")

$oButton = _IEGetObjByName ($oFrame, "java script:UpdateFramesExternal()")

_IEAction($oButton,"click")

Anyone please.

Thank you,

Rick

--------------

<body>

<h1>Controls</h1>

<form name=controlForm action='java script:UpdateContents("BasketViewer?a=showContents")'>

<!--Start the outer table with frame width, to contain all inner tables with control buttons: !-->

<table align='left' width=178>

<tr><td align='left' width=178>

<table width=178>

<tr><td align='left' width=178>

<h3>Display Modes:</h3>

<A HREF='java script:ChangeDisplayMode("BasketViewer?a=frames&cd=showThumb&tb=0")'>

<div class=samesizelinks>Show Thumbnails</div></a>

<P class=spacer>&nbsp;</P>

<A HREF='java script:ChangeDisplayMode("BasketViewer?a=frames&cd=showImageFrames&tb=0")'>

<div class=samesizelinks>Show Images</div></a>

</td></tr>

<tr><td>

<input type=hidden value=4 name=itemsPerPage>

</td></tr>

</table>

<P class=spacer>&nbsp;</P>

<P class=spacer>&nbsp;</P>

<table width=178>

<tr><td align='left' width=178>

<P class=spacer>&nbsp;</P>

<h3>Publish:</h3>

<A HREF='java script:UpdateFramesExternal("Encapsulations", false)'> <div class=samesizelinks>Encapsulate All</div></a>

<P class=spacer>&nbsp;</P>

</tr></td>

</table>

<!--This ends the outer frame width table!-->

</td></tr></table

</form>

</body></html>

Link to comment
Share on other sites

Hopefully you are running this in SciTe so that you get the benefit of the console output. It will try to help you.

To use *ByName functions, the element must have a Name= or ID= and yours does not...

I would expect this to work: _IELinkClickByText($oFrame, "Encapsulate All") (you might have to put a space in front of Encapsulate however.

Give it a try and post the SciTe console output if you continue to have 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

Hopefully you are running this in SciTe so that you get the benefit of the console output. It will try to help you.

To use *ByName functions, the element must have a Name= or ID= and yours does not...

I would expect this to work: _IELinkClickByText($oFrame, "Encapsulate All") (you might have to put a space in front of Encapsulate however.

Give it a try and post the SciTe console output if you continue to have trouble.

Dale

Dale,

Thanks for the assist. The error now in SciTe console is:

--> IE.au3 Warning from function _IELinkClickByText, $_IEStatus_NoMatch

I tried without and with a space before Encapsulate.

I'm thinking the "frame" isn't being located.

The code from the main page looks like this:

<html><head><title>ImageSite - Powered by eQuorum</title></head>

<frameset cols='60,*' framespacing=0>

<frameset rows='25,*' framespacing=0>

<frameset cols='*,5' framespacing=0>

<frame name=sessionframe src='MainFrames?a=sessionapplet' scrolling=no frameborder=0 noresize marginheight=0 marginwidth=3>

<frame name=maintopmessage src='MainFrames?a=message' scrolling=no frameborder=0 noresize marginheight=1 marginwidth=1>

</frameset>

<frame name=mainleft src=ProjectOptions?projectid=657270 frameborder=0 noresize scrolling=no marginheight=1 marginwidth=1>

</frameset>

<frame name=mainright src='SelectProject?projectid=657270' frameborder=0 noresize marginheight=1 marginwidth=1>

</frameset>

</html>

I believe the "Encapsulate" button is in the mainleft frame.

Does that look about right?

Rick

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