Sign in to follow this  
Followers 0
Luke101

How to select a radio button in an iframe

10 posts in this topic

#1 ·  Posted (edited)

How would I click a radio button in an iframe. Here is the code for the iframe. The Iframe content is loaded by ajax

<IFRAME style="WIDTH: 100%; HEIGHT: 100%" id=DialogIframe src="/aveksa/main?ReqType=Dialog&amp;TableID=ActivityByWorkitemTable&amp;Action=Content&amp;PageNum=1&amp;isAjax=true&amp;PageID=WorkflowWorkItemPageData&amp;icon=changeRequest.gif&amp;Oid=2346%3AWPDS%3A1&amp;ObjectClass=com.aveksa.gui.objects.workflow.GuiWorkflowWorkItem&amp;PageSubTab=WorkItemMainPageData" frameBorder=0 name=DialogIframe></IFRAME>

here is an exmple of the radio:

<INPUT type="radio" name="nodeUserData_acm.trans.script.value" id="nodeUserData_acm.trans.script.valueCanceled" class="InputValueFld" style='white-space:nowrap;margin-left:0px;margin-right:5px;_margin-right:0px;width:13pxheight:13px;cursor:pointer' value="Canceled"  onClick="changeState(this)"  />
Edited by Luke101

Share this post


Link to post
Share on other sites



What code have you got so far? You can try _IEFormElementRadioSelect()

Share this post


Link to post
Share on other sites

What code have you got so far? You can try _IEFormElementRadioSelect()

Preceded by one of the _IEFrameGet*() functions so that you can drill into it.

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

#4 ·  Posted (edited)

here is the code I have so far but it does not work:

_IENavigate($oIE, $url1])
Sleep(500)

$theFrame = _IEFrameGetCollection($oIE, 2)
$oForm1 = _IEFormGetObjByName($oIE, "WorkItemForm")
_IEFormElementRadioSelect($oForm1, 1, "Canceled", 1, "byIndex")
Edited by Luke101

Share this post


Link to post
Share on other sites

Preceded by one of the _IEFrameGet*() functions so that you can drill into it.

Dale

Quick question: If _IEFormElementRadioSelect() only works on Forms, according to the Help File, what good does it do to get a reference to the Frame? Or are they interchangeable? Just wondering...discrepancies like this have already come up a couple times recently... like in thread where you can use _IELinkClickByText() with a Form object even though Help File didn't mention you could.

Share this post


Link to post
Share on other sites

There is no discrepancy - here or in the other thread you mention. That other thread contains a false conclusion.

In general, frame objects ($oFrame) and InternetExplorer.Application objects ($oIE) can be used interchanably and it is stated as such in each place it applies in the documentation.

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

In general, frame objects ($oFrame) and InternetExplorer.Application objects ($oIE) can be used interchanably and it is stated as such in each place it applies in the documentation.

Dale

I appreciate you helping to clear it up but I'm still confused... plain and simple the Help File states the first parameter for _IEFormElementRadioSelect(), $o_object, needs to be "Object variable of an InternetExplorer.Application, Form object" which I read as it can be either or. No where that I can see does it say you can use a Frame object instead of an Application object. If this applies to this function, why don't I see it? Other functions, like _IEDocReadHTML() say specifically you can supply an IE Application, Window or Frame.

Let me put it another way... If this was my first day using IE Functions, where exactly would I stumble upon the fact that I could use a Frame instead of Application for this or any other function it applies to if it isn't already specifically stated such as in the _IEDocReadHTML example I just noted above?

Again..thank you very much for taking the time to point me in the right direction :D

Share this post


Link to post
Share on other sites

The documentation you are referring to is, in fact, trying to be too precise. It should simply state that the first parameter must be a Form object.

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

Just because no one else asked; is the Form collection returning the correct form that contains the element you're after?

also can you post the HTML of what you are trying to interact with?


A true renaissance man

Share this post


Link to post
Share on other sites

Hi I have solved this issue with this code:

_IENavigate($oIE, $url")
 $o_frame = _IEFrameGetCollection($oIE, 1)
 $actionInput = _IEGetObjById($o_frame, $actionId)
 _IEAction($actionInput, "click")
 $comment = _IEGetObjById($o_frame, "comment")
 $comment.value = $performMessage

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  
Followers 0