Jump to content

Recommended Posts

Posted

Hi I need some help on clicking javascript button.

The html source code is:

<html>
    <head>
        <link rel="stylesheet" href="Toc.css" type="text/css"/>
        <base target="main">
        <script type="text/javascript" src="UserAdjustments.js"></script>
        <script type="text/javascript" src="Toc.js"></script>
        <script type="text/javascript" src="ivs_iva_id.js"></script>
        <script type="text/javascript" src="BoardInfo.js"></script>
        <script type="text/javascript">
                head1 =
[           
    ["General", 
        [
            ["LiveVideo", null,"/user/LiveVideo.html", "Live Video"],
            ["PTZControl", null,"/user/PTZControl.html", "Pan Tilt Zoom"],
            ["TTLStatus", null,"/user/GetTTLStatus.xml", "Alarms and <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Contact Closures"],
            ["ActiveStreams", null,"/user/Streams.cgi", "AV Active Streams"]
        ], false, "General"],
    ["VideoSettings", 
        [
            ["AnalogVideo", null,"/user/AnalogVideoSettings.xml", "Analog"], 
            ["VideoEncoder", [
                ["MPEG4",null,"/user/MPEG4params.xml", "MPEG4"],
                ["H.264",null,"/user/H264Params.xml", "H.264"],
                ["MJPEG",null,"/user/MJPEGParams.xml", "MJPEG"]],false, "Encoder"], 
            ["DigitalVideo", null,"/user/DigitalVideoSettings.xml", "Decoder"],
            ["StreamingParameters",null,"/user/VideoStreamingParams.xml", "Streaming Parameters"]
        ],false, "Video"],
    ["Audio", 
        [
            ["AudioStreamingParams", null,"/user/AnalogAudioSettings.xml", "Analog"],       
            ["AudioEncoder", [
                ["MPEG12Layer2",null,"/user/Mpeg1_2Layer2params.xml", "MP2"],
                ["MP3",null,"/user/MP3params.xml", "MP3"]],false, "Encoder"]
        ],false, "Audio"],
    ["System", 
        [
            ["NetworkSettings", null,"/user/NetworkSettings.xml", "Network Settings"],
            ["GeneralStreamingParameters", null,"/user/StreamingGeneral.xml", "Streaming Parameters"],          
            ["ClockSetup", null,"/user/ClockSetup.xml", "Clock"],
            ["FlashUpdate", null,"/user/WriteFlash.cgi", "Update Software"],
            ["ChangePW", null,"/user/UserPw.xml", "Users"],
            ["Reset", null,"/user/ResetNReloadBoard.html", "Reset"],
            ["Shutdown", null,"/user/ShutdownBoard.html", "Shutdown"],
            ["About", null,"/user/About.cgi", "Version"]
        ],false, "System"]
];

            if(ivs_iva_id == 'IVA')
            {
                var head2 = new Array();
                var i, j = 0;
                for (i = 0; i < head1.length; i++)
                    if(head1[i][0] != 'Streaming')
                        head2[j++] = head1[i];
                head1 = head2;
            }
            if (TTL_IN == 0 && TTL_OUT == 0)
            {
                var head3 = new Array();
                var i, j = 0;
                for (i = 0; i < head1[0][1].length; i++)
                {
                    if(head1[0][1][i][0] != 'TTLStatus')
                        head3[j++] = head1[0][1][i];
                }
                head1[0][1] = head3;        
            }
            onload = function(){on_Load()}
        </script>
    </head>
    <body>
        <table   width="220" height="40"   id="MyTable"/>
    </body>
</html>

I want to automate clicks on "System" and then on "FlashUpdate"

I was unable to do the task via IE.au3.

My code is:

#include <IE.au3>

$oIE =_IECreate("http://192.168.102.21",0,1, 0)
;sleep(1000)
WinWaitActive("Windows Security","")
ControlSetText("Windows Security", "", "[CLASSNN:Edit1]", "user")
ControlSetText("Windows Security", "", "[CLASSNN:Edit2]", "User123")
ControlClick("Windows Security", "", "[CLASSNN:Button2]")


$oDiv = _IEGetObjById($oIE, 'System')
;$oTDs = _IETagNameGetCollection($oDiv, 'td')

Any help will be appreciated!

Be Green Now or Never (BGNN)!

Posted

You can't use controlclick on Javascript. Look at the IE tools in the helpfile.

 

I did not try to use controlclick on Javascript, the code above use the controlclick to pass the basic authentication popup message when I launch the page.

I am trying to click on this part of the page that manged by javascript code.

["System", 
        [
            ["NetworkSettings", null,"/user/NetworkSettings.xml", "Network Settings"],
            ["GeneralStreamingParameters", null,"/user/StreamingGeneral.xml", "Streaming Parameters"],          
            ["ClockSetup", null,"/user/ClockSetup.xml", "Clock"],
            ["FlashUpdate", null,"/user/WriteFlash.cgi", "Update Software"],
            ["ChangePW", null,"/user/UserPw.xml", "Users"],
            ["Reset", null,"/user/ResetNReloadBoard.html", "Reset"],
            ["Shutdown", null,"/user/ShutdownBoard.html", "Shutdown"],
            ["About", null,"/user/About.cgi", "Version"]
        ],false, "System"]
];

Be Green Now or Never (BGNN)!

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
×
×
  • Create New...