Jump to content

How to select Radio button from a javascript popup


Recommended Posts

Hi forum,

Here is my code

#include <IE.au3>
$oIE = _IECreate("http://www.ncbi.nlm.nih.gov/pubmed/22561075")
_IELoadWait($oIE)
; get pointers to the login form and username and password fields
$oform = _IEFormGetObjByName($oIE, "EntrezForm")
$radio = _IEFormElementGetObjByName($oform, "EntrezSystem2.PEntrez.Pubmed.Pubmed_ResultsPanel.Pubmed_DisplayBar.sPresentation")

_IELinkClickByText ($oIE, "Display Settings:")

Problem: I need to select this radio button XML (Value: 6) and then i have to click Apply,

This popup seems like a javascript,

Note: This is not for any gaming purpose

Below is the screen shot of that popup

Please suggest me

Kindly help me in this

post-69004-0-50083200-1336639275_thumb.j

Edited by sathish
Link to comment
Share on other sites

Here is my updated code, which clicks Radio button too, now just one more button left, that is the Apply button

Please suggest

#include <IE.au3>
$oIE = _IECreate("http://www.xxx.xx.xx.com")
_IELoadWait($oIE)
$oform = _IEFormGetObjByName($oIE, "EntrezForm")
$radio = _IEFormElementGetObjByName($oform, "EntrezSystem2.PEntrez.Pubmed.Pubmed_ResultsPanel.Pubmed_DisplayBar.sPresentation")

_IELinkClickByText ($oIE, "Display Settings:")

$oDoc = _IEDocGetObj($oIE)
$oArray = $oDoc.getElementsByTagName ("input")
for $element in $oArray
if $element.value="xml" Then $element.checked=true            
next

Is this task really very tough??

This is my fifth post, without any solution??,

Very tired

Here with i have attached the html code of my site

pubmed1.htm

Edited by sathish
Link to comment
Share on other sites

There is nothing in your code that attempts to get a reference to the Apply button or to click it. What have you tried? Have you found the Apply button inthe HTML? what does the tag look likke? Have you used DebugBar or a similar tool to help you?

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

There is nothing in your code that attempts to get a reference to the Apply button or to click it. What have you tried? Have you found the Apply button inthe HTML? what does the tag look likke? Have you used DebugBar or a similar tool to help you?

Dale

Thanks for the reply

Here is my code

#include <IE.au3>
$oIE = _IECreate("http://xxx")
_IELoadWait($oIE)
; get pointers to the login form and username and password fields
$oform = _IEFormGetObjByName($oIE, "EntrezForm")
$radio = _IEFormElementGetObjByName($oform, "EntrezSystem2.PEntrez.Pubmed.Pubmed_ResultsPanel.Pubmed_DisplayBar.sPresentation")

_IELinkClickByText ($oIE, "Display Settings:")

$oDoc = _IEDocGetObj($oIE)
$oArray = $oDoc.getElementsByTagName ("input")
for $element in $oArray
if $element.value="xml" Then $element.checked=true
next

Please execute and see

The problem is i need to select the radio button (xml) then i need to click apply

I have written the code till clicking radio button, after that i dont know how to proceed

I tried all the codes related to (_IEForm), but nothing seems working

Please guide me

Thanks in advance

Edited by sathish
Link to comment
Share on other sites

First, answer these questions:

Have you found the Apply button inthe HTML? what does the tag look like? Have you used DebugBar or a similar tool to help you?

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

First, answer these questions:

Dale

Here is the apply button

<button name="EntrezSystem2.PEntrez.Pubmed.Pubmed_ResultsPanel.Pubmed_DisplayBar.SetDisplay" sid="1" class="button_apply ncbipopper-close-button">Apply</button>

.
.
.
.
.
var ActiveNames = {"p$ExL":1, "EntrezSystem2.PEntrez.DbConnector.Cmd":0, "EntrezSystem2.PEntrez.DbConnector.Db":0,
"EntrezSystem2.PEntrez.DbConnector.IdsFromResult":0, "EntrezSystem2.PEntrez.DbConnector.LastDb":0, "EntrezSystem2.PEntrez.DbConnector.LastIdsFromResult":0,
"EntrezSystem2.PEntrez.Pubmed.Pubmed_ResultsPanel.Pubmed_DisplayBar.SetDisplay":0, "EntrezSystem2.PEntrez.Pubmed.Pubmed_ResultsPanel.Pubmed_DisplayBar.Sort":0,
};

But i dont know anything about Debugbar, Please excuse me, I am a beginner

Have you tried to execute my script???

Edited by sathish
Link to comment
Share on other sites

If that's your buton and there are not frames,

$oButton = _IEGetObjByName($oIE, "EntrezSystem2.PEntrez.Pubmed.Pubmed_ResultsPanel.Pubmed_DisplayBar.SetDisplay")

_IEAction($oButton, "click")

find a link to DebugBar in my sig.

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

Javascript detect if it's clicked, so the xml radio must be clicked instead of the method you use.

Try this

#include <IE.au3>
$oIE = _IECreate("http://www.ncbi.nlm.nih.gov/pubmed/22561075")
_IELoadWait($oIE)
; get pointers to the login form and username and password fields
$oform = _IEFormGetObjByName($oIE, "EntrezForm")
$radio = _IEFormElementGetObjByName($oform, "EntrezSystem2.PEntrez.Pubmed.Pubmed_ResultsPanel.Pubmed_DisplayBar.sPresentation")
_IELinkClickByText ($oIE, "Display Settings:")

; <label for="xmltext">XML</label>
Local $oSubmit = _IEGetObjByName ( $oIE, 'xmltext' )
_IEAction ( $oSubmit, 'click' )
_IELoadWait($oIE)
;~ <button name="EntrezSystem2.PEntrez.Pubmed.Pubmed_ResultsPanel.Pubmed_DisplayBar.SetDisplay" sid="1" class="button_apply ncbipopper-close-button">Apply</button>
Sleep ( 1000 )
Local $oSubmit = _IEGetObjByName ( $oIE, 'EntrezSystem2.PEntrez.Pubmed.Pubmed_ResultsPanel.Pubmed_DisplayBar.SetDisplay' )
_IEAction ( $oSubmit, 'click' )
_IELoadWait ( $oIE )

;)

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Using _IEFormElementRadioSelect()

#include <IE.au3>

$oIE = _IECreate("[url="http://www.ncbi.nlm.nih.gov/pubmed/22561075"]http://www.ncbi.nlm.nih.gov/pubmed/22561075[/url]")

$oForm = _IEFormGetObjByName($oIE, "EntrezForm")
$sRadioGroupName = "EntrezSystem2.PEntrez.Pubmed.Pubmed_ResultsPanel.Pubmed_DisplayBar.sPresentation"
$sButtonName = "EntrezSystem2.PEntrez.Pubmed.Pubmed_ResultsPanel.Pubmed_DisplayBar.SetDisplay"

_IELinkClickByText ($oIE, "Display Settings:")
_IEFormElementRadioSelect($oForm, "xml", $sRadioGroupName, 1, "byValue")

$oApply = _IEGetObjByName ($oIE, $sButtonName)
_IEAction ( $oApply, 'click' )

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

Sorry for the late reply,

Now only i saw the thread,

Thanks for your kind help DaleHohm, wakillon, and searchresult, The script is working fine now

Once again thanks for your kind replies

Thanks & Regards

Sathish V.

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