Sign in to follow this  
Followers 0
icadea

Need help on IE3

6 posts in this topic

Hi all,

Instead of using Send keys to automate click on the links and drop down combo box,

I would like to know how this could be done using IE.au3. The two links I would like to this to be done is

1) <a href="#">compound trace</a>

2) <option value="2">drop2</option>

Kindly advise or show some examples on how this could be done using IE.au3. Thanks

I'm providing the code below.

<td colSpan="2">&nbsp; <span style="color: #FFC0C0">test</span>
                    </td>
                    <td align="right"><a href="#">compound trace</a>
                    </td>
                </tr>
                <tr vAlign="bottom" height="8">
                    <td>&nbsp;</td>
                    <td><span id="lblTable" style="width:129px;">Table</span></td>
                    <td><span id="lblContainer" style="width:129px;">link name</span></td>
                </tr>
                <tr vAlign="middle">
                    <td></td>
                    <td><select name="cmbTable" onchange="__doPostBack('cmbTable','')" language="javascript" id="cmbTable" onclick="cmbTable_onclick()">
    <option selected="selected" value="0"></option>
    <option value="1">drop1</option>
    <option value="2">drop2</option>

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

For the first one, _IELinkClickByText() should work.

For the second one, study this example:

#include <IE.au3>
Dim $Selected[2]
;Create the explorer
$oIE =_IECreate("http://losprofes.110mb.com/test/page.html")


;Get the form
$oForm = _IEFormGetObjByName ($oIE, "myform")
;Get the dropdown
$oSelect = _IEFormElementGetObjByName ($oForm, "mydropdown")
;Select 2nd item in dropdown. (by index)
_IEFormElementOptionselect ($oSelect, 1, 1, "byIndex")
;Get the value of the selected item
$Selected[0]= _IEFormElementGetValue($oSelect)
;Show you the value
MsgBox(0,"","Selected: "&$Selected[0])
;Go to the next page
_IELinkClickByText($oIE ,"Go to page 2")
;Wait.
_IELoadWait($oIE)


;Get the form
$oForm = _IEFormGetObjByName ($oIE, "myform")
;Get the dropdown
$oSelect = _IEFormElementGetObjByName ($oForm, "mydropdown")
;Select 1st item of the dropdown (by value)
_IEFormElementOptionselect ($oSelect, "Bread", 1)
;Get value of the selected item
$Selected[1]= _IEFormElementGetValue($oSelect)
;Show you the value
MsgBox(0,"","Selected: "&$Selected[1])
Edited by Nahuel

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks for the help nahuel. I'll study them.

I modified the examples slightly. This works in IE6 but not in IE7, the page loads in a tab but the dropdown box is not chosen.

Is there a workaround so the same script works in both IE version.

Func first()
    _GUICtrlComboBox_SetCurSel($comb, 0)
    $oIE = _IECreate("http://test/inst/frmApp.aspx")
    If WinWaitActive("frmApp - Microsoft Internet Explorer", "", 5) Then
        WinActivate("frmApp - Microsoft Internet Explorer")
        $oForm = _IEFormGetObjByName($oIE, "Form1")
        $oSelect = _IEFormElementGetObjByName($oForm, "cmbTable")
        _IEFormElementOptionselect($oSelect, "first", 1, "byText")
    Else
    EndIf
EndFunc   ;==>first

have searched through the forum but could not find any examples. Please help. thanks

Edited by icadea

Share this post


Link to post
Share on other sites

can anyone help on this. just need to know if there is a possibility of creating one script that will work with both IE6 and IE7 if yes than how could i modify the script above.

thanks

Share this post


Link to post
Share on other sites

Func first()
    _GUICtrlComboBox_SetCurSel($comb, 0)
    $oIE = _IECreate("http://test/inst/frmApp.aspx")
    $oForm = _IEFormGetObjByName($oIE, "Form1")
    $oSelect = _IEFormElementGetObjByName($oForm, "cmbTable")
    _IEFormElementOptionselect($oSelect, "first", 1, "byText")
EndFunc  ;==>first


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

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