I need some help clicking a button on a web page.

Posted on
Sat Oct 31, 2015 11:35 am
Swancoat offline
Posts: 503
Joined: Nov 20, 2009
Location: Houston

I need some help clicking a button on a web page.

There doesn't seem to be much traffic in this section, but hopefully there's enough!

I'm trying to make a script that I can use to reboot a hardware music server I have (NuVo MusicPort). It's relatively straightforward to do, load the page, click the button, and a box comes up asking if you're sure, and I want to click 'ok'.

I have an applescript (attached) that loads the page and clicks the button. The problem is the dialog box that pops up asking "Are you sure you want to restart the server?". I've found many methods online for how to click a button on a dialog box, and even tried things like telling system events to enter "Keystroke return" ('OK' is the default selection). However none of it works. Some more testing and troubleshooting eventually shows me that as soon as the dialog box pops up, the applescript stops running until *I* click on a button and dismiss it (however, I can't make Applescript click on it).

This is the code I'm currently using to load the page and click the link on the page:
Code: Select all
--Define Web Page Loader
to goToWebPage(theWebPage)
   tell application "Safari"
      activate
      set URL of document 1 to theWebPage
   end tell
end goToWebPage

--Define method to click a button by it's ID
to clickID(theID)
   tell application "Safari"
      do JavaScript "document.getElementById('" & theID & "').click();" in document 1
   end tell
end clickID

--load the page, wait a second, and click the button.
try
   goToWebPage("http://10.0.1.10/Config/Machine.aspx")
   delay 5
   
   clickID("btnReboot")
   --delay 2
   
   ---supposed to deal with the stupid dialog box, but doesn't seem to work.
   --problem is that it doesn't even get here. Nothing runs until box is dismissed.
   tell application "System Events" to tell process "Safari"
      click button "OK" of window 1
   end tell
end try


I'm also attaching all of the html for the web page in question... I'm totally open to any other kind of solution here that bypasses the dialog box and just 'runs the process' using either AppleScript or Python (my current skill level has me just trying to replicate the button clicks).

Page html:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1"><title>
   Server Settings
</title><link href="Content/style.css" rel="stylesheet" type="text/css" /><link href="Content/ui.datepicker.css" rel="stylesheet" type="text/css" /><link href="Content/jquery.timeentry.css" rel="stylesheet" type="text/css" /></head>
<body bgcolor="000000" >
    <script src="Scripts/jquery-1.2.6.min.js" type="text/javascript"></script>
    <script src="Scripts/jquery.validate.min.js" type="text/javascript"></script>
    <script src="Scripts/autonomic.validate.js" type="text/javascript"></script>

    <script src="Scripts/jquery.alphanumeric.pack.js" type="text/javascript"></script>
   
    <!-- jquery.datePicker.js -->
    <script src="scripts/date.js" type="text/javascript" ></script>
    <script src="scripts/jquery.bgiframe.js" type="text/javascript" ></script>
    <script src="scripts/jquery.datePicker.js" type="text/javascript" ></script>   
   
    <!-- jquery.timeentry.js -->
   <script src="Scripts/jquery.timeentry.js" type="text/javascript"></script>

<form name="form1" method="post" action="Machine.aspx" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE2OTk3NDczMjFkZIJfcpCEINjIK6rfqR1i14y64u1w" />

<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWDQLiqf/HCAKZ+sDFCAKo9oKOAgKVzu6tCQL9oMr4AgKag+SDDQKc0Nb1DgKjm47TDwKI5PiaBwKI5OyaBwLOnd+ODgKAgfvvBQLZ+umcDusqu9j2NpIhxj9HCqfrm5+r3Juk" />

<div id="wrapper">
   <div id='header'>
      <div id='logo'>
           <h1><a href='/MusicPort/'><span class='text'><span>Music Port</span></span></a></h1>
      <a href='http://www.nuvotechnologies.com/' target='_blank'><span class='logo'><span>NuVo Technologies Inc.</span></span></a>
      </div>

   </div>
   <!-- end #header -->
   <div id='menu'><ul><li><a href='Machine.aspx' class='a'><span class='a2'>Machine Settings</span></a></li><li><a href='Sources.aspx' class='a'><span class='a2'>Source Settings</span></a></li><li><a href='Content.aspx' class='a'><span class='a2'>Content</span></a></li><li><a href='Software.aspx' class='a'><span class='a2'>Firmware</span></a></li></ul></div>
   <!-- end #menu -->
   <div id="page">
      <div id="banner">&nbsp;</div>
      <div id="content">

         <div class="post">
            <h1 class="title"><a href="#">Server Settings</a></h1>
                            
                <div class="entry">
                <fieldset id="gbsystemName">
                <legend>Server Identification</legend>
                <table width='100%'>
                     <tr>
                                <td class="label"><label id="lsystemName" for="tbSysName">Name</label></td>

                         <td class="field">
                             <input name="tbSysName" type="text" value="MUSIC-PORT" id="tbSysName" class="required setvalue" ci="1" cicat="SYSTEM" ciname="NAME" />
                         </td>
                                <td class="status"></td>
                     </tr>
                     <tr>
                                <td class="label"><label id="lsystemDescription" for="tbSysDescrip">Description</label></td>
                         <td class="field">

                         <input name="tbSysDescrip" type="text" value="NuVo Music Port Server NV-MPS4" id="tbSysDescrip" class="required setvalue" ci="1" cicat="SYSTEM" ciname="DESCRIPTION" style="width:300px;" />
                         </td>                        
                                <td class="status"></td>
                     </tr>
               </table>
                </fieldset>
                </div>
               
               
               
                <div class="entry">
                <fieldset id="dateAndTime"><legend>Date and Time</legend>

                <table width='100%'>

                     <tr class="btnNtpSync">
                                <td class="label"><label id="ltbSysDate" for="tbSysDate">Date</label></td>
                         <td class="field"><div id='timeString' style="font-weight:bold;">12:34:11 PM Saturday, October 31, 2015</div></td>
                                <td class="status"></td>
                     </tr>
               
                     <tr class="btnNtpSync">

                                <td class="label"><label id="llbSysTimeZone" for="lbSysTimeZone">Time zone</label></td>
                         <td class="field">
                            <select id="lbSysTimeZone" name="lbSysTimeZone" style="width:300px;" cicat='SYSTEM' ciname='TIME_ZONE' class='setvalue' ><option  value="0" >(GMT-12:00) International Date Line West</option><option  value="1" >(GMT-11:00) Midway Island, Samoa</option><option  value="2" >(GMT-10:00) Hawaii</option><option  value="3" >(GMT-09:00) Alaska</option><option  value="4" >(GMT-08:00) Pacific Time (US & Canada)</option><option  value="5" >(GMT-08:00) Tijuana, Baja California</option><option  value="6" >(GMT-07:00) Arizona</option><option  value="7" >(GMT-07:00) Chihuahua, La Paz, Mazatlan - New</option><option  value="8" >(GMT-07:00) Chihuahua, La Paz, Mazatlan - Old</option><option  value="9" >(GMT-07:00) Mountain Time (US & Canada)</option><option  value="10" >(GMT-06:00) Central America</option><option selected="selected" value="11" >(GMT-06:00) Central Time (US & Canada)</option><option  value="12" >(GMT-06:00) Guadalajara, Mexico City, Monterrey - New</option><option  value="13" >(GMT-06:00) Guadalajara, Mexico City, Monterrey - Old</option><option  value="14" >(GMT-06:00) Saskatchewan</option><option  value="15" >(GMT-05:00) Bogota, Lima, Quito, Rio Branco</option><option  value="16" >(GMT-05:00) Eastern Time (US & Canada)</option><option  value="17" >(GMT-05:00) Indiana (East)</option><option  value="18" >(GMT-04:30) Caracas</option><option  value="19" >(GMT-04:00) Atlantic Time (Canada)</option><option  value="20" >(GMT-04:00) La Paz</option><option  value="21" >(GMT-04:00) Manaus</option><option  value="22" >(GMT-04:00) Santiago</option><option  value="23" >(GMT-03:30) Newfoundland</option><option  value="24" >(GMT-03:00) Brasilia</option><option  value="25" >(GMT-03:00) Buenos Aires</option><option  value="26" >(GMT-03:00) Georgetown</option><option  value="27" >(GMT-03:00) Greenland</option><option  value="28" >(GMT-03:00) Montevideo</option><option  value="29" >(GMT-02:00) Mid-Atlantic</option><option  value="30" >(GMT-01:00) Azores</option><option  value="31" >(GMT-01:00) Cape Verde Is.</option><option  value="32" >(GMT) Casablanca</option><option  value="33" >(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London</option><option  value="34" >(GMT) Monrovia, Reykjavik</option><option  value="35" >(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna</option><option  value="36" >(GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague</option><option  value="37" >(GMT+01:00) Brussels, Copenhagen, Madrid, Paris</option><option  value="38" >(GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb</option><option  value="39" >(GMT+01:00) West Central Africa</option><option  value="40" >(GMT+02:00) Amman</option><option  value="41" >(GMT+02:00) Athens, Bucharest, Istanbul</option><option  value="42" >(GMT+02:00) Beirut</option><option  value="43" >(GMT+02:00) Cairo</option><option  value="44" >(GMT+02:00) Harare, Pretoria</option><option  value="45" >(GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius</option><option  value="46" >(GMT+02:00) Jerusalem</option><option  value="47" >(GMT+02:00) Minsk</option><option  value="48" >(GMT+02:00) Windhoek</option><option  value="49" >(GMT+03:00) Baghdad</option><option  value="50" >(GMT+03:00) Kuwait, Riyadh</option><option  value="51" >(GMT+03:00) Moscow, St. Petersburg, Volgograd</option><option  value="52" >(GMT+03:00) Nairobi</option><option  value="53" >(GMT+03:00) Tbilisi</option><option  value="54" >(GMT+03:30) Tehran</option><option  value="55" >(GMT+04:00) Abu Dhabi, Muscat</option><option  value="56" >(GMT+04:00) Baku</option><option  value="57" >(GMT+04:00) Caucasus Standard Time</option><option  value="58" >(GMT+04:00) Yerevan</option><option  value="59" >(GMT+04:30) Kabul</option><option  value="60" >(GMT+05:00) Ekaterinburg</option><option  value="61" >(GMT+05:00) Islamabad, Karachi</option><option  value="62" >(GMT+05:00) Tashkent</option><option  value="63" >(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi</option><option  value="64" >(GMT+05:30) Sri Jayawardenepura</option><option  value="65" >(GMT+05:45) Kathmandu</option><option  value="66" >(GMT+06:00) Almaty, Novosibirsk</option><option  value="67" >(GMT+06:00) Astana, Dhaka</option><option  value="68" >(GMT+06:30) Yangon (Rangoon)</option><option  value="69" >(GMT+07:00) Bangkok, Hanoi, Jakarta</option><option  value="70" >(GMT+07:00) Krasnoyarsk</option><option  value="71" >(GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi</option><option  value="72" >(GMT+08:00) Irkutsk, Ulaan Bataar</option><option  value="73" >(GMT+08:00) Kuala Lumpur, Singapore</option><option  value="74" >(GMT+08:00) Perth</option><option  value="75" >(GMT+08:00) Taipei</option><option  value="76" >(GMT+09:00) Osaka, Sapporo, Tokyo</option><option  value="77" >(GMT+09:00) Seoul</option><option  value="78" >(GMT+09:00) Yakutsk</option><option  value="79" >(GMT+09:30) Adelaide</option><option  value="80" >(GMT+09:30) Darwin</option><option  value="81" >(GMT+10:00) Brisbane</option><option  value="82" >(GMT+10:00) Canberra, Melbourne, Sydney</option><option  value="83" >(GMT+10:00) Guam, Port Moresby</option><option  value="84" >(GMT+10:00) Hobart</option><option  value="85" >(GMT+10:00) Vladivostok</option><option  value="86" >(GMT+11:00) Magadan, Solomon Is., New Caledonia</option><option  value="87" >(GMT+12:00) Auckland, Wellington</option><option  value="88" >(GMT+12:00) Fiji, Kamchatka, Marshall Is.</option><option  value="89" >(GMT+13:00) Nuku'alofa</option></select>

                             <div id="divDstSetting" style="display:none;height:30px;margin-top:5px;" >
                                        <span class="setvalue" ci="1" cicat="SYSTEM" ciname="TIME_ZONE_ENABLE_DST"><input id="cbEnableDST" type="checkbox" name="cbEnableDST" checked="checked" /><label for="cbEnableDST">Adjust clock for Daylight Saving Time.</label></span>                                
                             </div>
                             <div id="divDstSettingDisabled" style="display:none;height:30px;" >
                                 <br />
                             </div>
                         </td>
                                <td class="status"></td>
                     </tr>

                     <tr class="btnNtpSync">
                                <td class="label"><label id="llbSysNtpServer" for="lbSysNtpServer">NTP Server</label></td>
                         <td class="field">
                             <select id="lbSysNtpServer" name="lbSysNtpServer" style="width:300px;" cicat='SYSTEM' ciname='NTP_SERVER' class='setvalue' ><option  value="asia.pool.ntp.org" >asia.pool.ntp.org</option><option  value="europe.pool.ntp.org" >europe.pool.ntp.org</option><option  value="oceania.pool.ntp.org" >oceania.pool.ntp.org</option><option selected="selected" value="north-america.pool.ntp.org" >north-america.pool.ntp.org</option><option  value="south-america.pool.ntp.org" >south-america.pool.ntp.org</option><option  value="africa.pool.ntp.org" >africa.pool.ntp.org</option></select>
                         </td>

                                <td class="status"></td>
                     </tr>                     
                     <tr>
                                <td class="label"><label id="lblSysNtpSync" for="btnSysNtpSync"></label></td>
                         <td class="field">
                            <input id="btnNtpSync" style="display:none;" type='button'  class='cancel btnNtpSync' onclick="return syncTime(this);" value=" Update time from NTP Server " />
                            <div id="divNtpSync" style="display:none;"><img src="content/images/indicator.gif"  />&nbsp;NTP Sync in progress</div>
                         </td>
                                <td class="status"></td>

                     </tr>
                     
                     <tr class="btnNtpSync">
                                <td class="label"><label id="lblSysNuVoSync" for="cbNuVoSync"></label></td>
                         <td class="field"><span class="setvalue" ci="1" cicat="MRAD" ciname="SYNC_TIME"><input id="cbSyncBridge" type="checkbox" name="cbSyncBridge" checked="checked" /><label for="cbSyncBridge">Synchronize NuVo amplifier's clock.</label></span></td>
                                <td class="status"></td>
                     </tr>
                                                          
                     
                    </table>
                </fieldset>

                </div>

               
                <div class="entry">
                <fieldset id="ethernet"><legend>Wired Ethernet (00:27:0E:10:9E:CD)</legend>
                   <table width='100%'>
                     <tr>
                                <td class="label"><label id="lethernetDhcp" for="ethernetDhcp">Connection</label></td>
                         <td class="field"><select id="ethernetDhcp" name="ethernetDhcp" style="width:300px;" cicat='ETHERNET' ciname='DHCP' class="setvalue">

                              <option value="true" selected="selected" >Automatic Configuration (DHCP) - 10.0.1.10</option>
                              <option value="false"  >Manual Configuration (Static IP)</option>
                           </select></td>
                                <td class="status"></td>
                     </tr>
                     <tr class="wiredStaticIp">
                         <td class="label"><label id="ltbWiredEthIp" for="tbWiredEthIp">IP Address</label></td>

                        <td><input name="tbWiredEthIp" type="text" value="10.0.1.10" id="tbWiredEthIp" class="ipAddress setvalue" ci="1" cicat="ETHERNET" ciname="IP_ADDRESS" style="width:300px;" /></td>
                        <td class="status"></td>
                     </tr>
                     <tr class="wiredStaticIp">
                         <td class="label"><label id="ltbWiredEthSubnet" for="tbWiredEthSubnet">Subnet Mask</label></td>
                                <td><input name="tbWiredEthSubnet" type="text" value="255.255.255.0" id="tbWiredEthSubnet" class="ipAddress setvalue" ci="1" cicat="ETHERNET" ciname="IP_SUBNET" style="width:300px;" /></td>                        
                        <td class="status"></td>
                     </tr>
                     <tr class="wiredStaticIp">

                         <td class="label"><label id="ltbWiredEthGateway" for="tbWiredEthGateway">Gateway</label></td>
                                <td><input name="tbWiredEthGateway" type="text" value="10.0.1.1" id="tbWiredEthGateway" class="ipAddress setvalue" ci="1" cicat="ETHERNET" ciname="IP_GATEWAY" style="width:300px;" /></td>                        
                        <td class="status"></td>
                     </tr>
                     <tr class="wiredStaticIp">
                         <td class="label"><label id="ltbWiredEthDns1" for="tbWiredEthDns1">DNS 1</label></td>
                                <td><input name="tbWiredEthDns1" type="text" value="75.75.75.75" id="tbWiredEthDns1" class="ipAddress setvalue" ci="1" cicat="ETHERNET" ciname="IP_DNS_1" style="width:300px;" /></td>                        
                        <td class="status"></td>
                     </tr>

                     <tr class="wiredStaticIp">
                         <td class="label"><label id="ltbWiredEthDns2" for="tbWiredEthDns2">DNS 2</label></td>
                                <td><input name="tbWiredEthDns2" type="text" value="8.8.8.8" id="tbWiredEthDns2" class="ipAddress setvalue" ci="1" cicat="ETHERNET" ciname="IP_DNS_2" style="width:300px;" /></td>                        
                        <td class="status"></td>
                     </tr>
                    </table>
                </fieldset>
                </div>
               
                <div class="entry">

                <fieldset id="Fieldset1"><legend>Logging</legend>
            

                   <table width='100%'>
                  <tr>
                      <td class="label"><label id="lbltbLogEmail" for="tbLogEmail">Your email</label></td>
                     <td><input name="tbLogEmail" type="text" id="tbLogEmail" class="setvalue" ci="1" cicat="LOGGING" ciname="FROM_EMAIL" style="width:300px;" /></td>
                     <td class="status"></td>
                  </tr>
                  <tr>

                      <td class="label"><label id="lbltbComments" for="tbComments">Comments</label></td>
                     <td><textarea name="tbComments" rows="2" cols="20" id="tbComments" class="setvalue" ci="1" cicat="LOGGING" ciname="COMMENTS" style="width:300px;height:100px"></textarea></td>                     
                     <td class="status"></td>
                  </tr>
                  <tr>
                      <td class="label"><label id="Label2" for="cbAdditionalData">Include media database</label></td>
                     <td><span class="setvalue" ci="1" cicat="LOGGING" ciname="INCLUDE_DATA"><input id="cbAdditionalData" type="checkbox" name="cbAdditionalData" /></span></td>
                     <td class="status"></td>

                  </tr>                  
                  <tr>
                            <td class="label"><label id="Label1" for="btnUploadLogFiles"></label></td>
                      <td class="field"><input type='button'  class='cancel' onclick="return uploadLogFiles(this);" value=" Upload Log Files " /></td>
                            <td class="status"></td>
                  </tr>                  
                    </table>

               
                </fieldset>
                </div>

            
                <div class="entry">
                <fieldset id="Fieldset2"><legend>Utilities</legend>
            

                   <table width='100%'>
                  <tr>
                            <td class="label"></td>
                      <td class="field" style="vertical-align:middle;cursor:pointer"><a href="#" id="btnReboot" onclick="return rebootServer(this);"><span style="font-size:larger;vertical-align:top">Restart your server</span></a></td>
                            <td class="status"></td>

                  </tr>                  
                    </table>

               
                </fieldset>
                </div>
            </div>
       </div>
        <!-- end #content -->
      
      <div id="sidebar">
         <ul>

             <li id='save'>
               <h2>Save</h2>
                     <input type='submit' id='saveButton'   name='save'   value='Save Changes'  class='cancel' style='width:200px' onclick="return emsAction('save', this);" />
                     <input type='submit' id='revertButton' name='revert' value='Undo Changes'  class='cancel' style='width:200px'  />
               <div>&nbsp;</div>
            </li>
            <li>
               <h2>Server Identification</h2>

               <p>Name – this setting identifies this server on your network. </p>
               <p>Description – enter a description and/or location for this server.</p>
            </li>
            
            <li>
               <h2>Date and Time</h2>
               <p>Time Zone – Enter your local time zone.</p>
               <p>NTP Server – Select the internet time server closest to your location.</p>

               <p>The <i>Synchronize Now</i> button will force your server to synchronize its clock with the time server.</p>
            </li>
            
            <li>
               <h2>Wired Ethernet</h2>
               <p><strong>Connection</strong>: Select the connection method for attaching to your wired network. If you choose to configure this setting manually, you will have to provide an unused IP address, subnet mask, gateway and DNS server address.  If you are unsure of these settings, use the automatic (DHCP) setting, or contact your network administrator.</p>

            </li>      

            <li>
               <h2>Logging</h2>
               <p>Use this section to upload log files when directed to do so by technical support.</p>
            </li>                        
                        
         </ul>
      </div>
      <!-- end #sidebar -->
      <div style="clear: both;">&nbsp;</div>

   <!-- end #page -->
    </div>
    <!-- Footer -->
   <div id='footer'><p>&copy; Copyright 2006-2015 <a href='http://www.Autonomic-Controls.com/'>Autonomic Controls, Inc.</a> All rights reserved.</p><p>Version 5.0.15934.4 Release.</p></div>
   <!-- end #footer -->
</div>   
    </form>

   
<script type="text/javascript">
  var g_callCount = 0;
  var g_tickTimeOut=0;
  var g_lastNtpSyncState = -1;
 
  function timeZoneChanged(e) {
        var selObj = $('#lbSysTimeZone')[0];
        if (selObj == null)
            return;
                   
        var selIndex = selObj.selectedIndex;
        var selValue = selObj.options[selIndex].value;
       
         post = $.ajax({
              url: "sv.aspx",
             data: "x=1&action=qdst&value="+selValue,
            async: false,
            cache: false
          }).responseText;
         
        if (post=="1") {
            $("#divDstSetting").show();   
            $("#divDstSettingDisabled").hide();   
        }
        else {
           $("#divDstSetting").hide();   
           $("#divDstSettingDisabled").show();   
        }
    } 
 
  timeZoneChanged(null); 
 
  function syncTime(ctrl) {

     emsAction('ntpsync',ctrl); 
     
     $(".btnNtpSync").hide();
     $("#divNtpSync").show();
     
     if (g_tickTimeOut!=0)
        clearTimeout(g_tickTimeOut);
       
     g_tickTimeOut = setTimeout("getTime()", 5000);
     
   
     return false;
  }
 
  function getTime() {
 
      var post;
     
      try
      {
            g_callCount++;
           
             post = $.ajax({
              url: "getstatus",
             data: "x="+g_callCount,
            async: false,
            cache: false
          }).responseText;
         
          //$("#statusText").text( g_callCount+": " +post );
      }
      catch(e)
      {
         $("#divNtpSync").hide();
         return;
      }
     
      try
      {
        eval(post);
      }
      catch(e)
      {
        $("#divNtpSync").hide();
        return;
      }
     
      $("#timeString").text( status.timeStamp );
     
      if (status.ntpsyncInProgress==0) {
         $(".btnNtpSync").show();
         $("#divNtpSync").hide();
      }
      else {
         $(".btnNtpSync").hide();
         $("#divNtpSync").show();
      }
     
      g_tickTimeOut = setTimeout("getTime()", 1000);     
  }
 
  function uploadLogFiles(sender) {
    if (echeck( $("#tbLogEmail").val() ) == false ) {
       var dest = $("#tbLogEmail").parent("td").next("td");
       dest.html("<label class='error'>Invalid email address</label>");

         alert("Invalid email address");

       $("#tbLogEmail").focus();
        return false;
    }
       
    if ($("#tbComments").val() == '') {
       var dest = $("#tbComments").parent("td").next("td");
       dest.html("<label class='error'>Comments are required</label>");
   
       alert("Comments are required");
       $("#tbComments").focus();
        return false;
    }
   
    //var x = prompt("Enter log file password provided by tech support:", "");
       
    var rVal = emsAction('uploadLogFiles',sender);
    $("#tbComments").val('');
    return rVal;
  }
 
function echeck(str) {

      var at="@";
      var dot=".";
      var lat=str.indexOf(at);
      var lstr=str.length;
      var ldot=str.indexOf(dot);
      if (str.indexOf(at)==-1){
         return false;
      }

      if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
         return false;
      }

      if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
          return false;
      }

       if (str.indexOf(at,(lat+1))!=-1){
          return false;
       }

       if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
          return false;
       }

       if (str.indexOf(dot,(lat+2))==-1){
          return false;
       }
      
       if (str.indexOf(" ")!=-1){
          return false;
       }

        return true;
   }

  function onDateSelected(e, selectedDate, $td, status)  {
    var value = (selectedDate.getMonth()+1)+'/'+selectedDate.getDate()+'/'+selectedDate.getYear();
    var postData = "cat=SYSTEM&name=DATE&value="+value;
    callAjax(postData);
  }
 
  function onTimeSelected(){
    var value = $('#tbSysTime').val();
    var postData = "cat=SYSTEM&name=TIME&value="+value;
    callAjax(postData);
  }

  $('#tbSysName').alphanumeric({ allow: "-" });
  $('#tbSysDescrip').alphanumeric({ allow: "- '" });

 


  $('#cbEnableDST')
    .bind('click', function(e) {
       
        var value = $('#cbEnableDST')[0].checked ? 'True' : 'False';

        setParamAjax(value, $('#cbEnableDST').parent()[0], null);
    });


  $('#cbSyncBridge')
    .bind('click', function(e) {
       
        var value = $('#cbSyncBridge')[0].checked ? 'True' : 'False';

        setParamAjax(value, $('#cbSyncBridge').parent()[0], null);
    });

  $('.ipAddress')
    .numeric({ allow: "." })
    .css("text-align", "right");
   
  $('.seconds')
    .numeric()
    .css("text-align", "right");
       
  $('#ethernetDhcp')
    .bind('change', wiredConnectionTypeChanged);

    function wiredConnectionTypeChanged(e) {
        var selObj = $('#ethernetDhcp')[0];
        if (selObj == null)
            return;
                   
        var selIndex = selObj.selectedIndex;
        var selValue = selObj.options[selIndex].value;

        if (selValue == "true")
            $('.wiredStaticIp').hide();
        else
            $('.wiredStaticIp').show();
    }

    wiredConnectionTypeChanged(null);
   
   
   
   
  $('#cbLogEnabled')
    .bind('click', function(e) {
       
        var value = $('#cbLogEnabled')[0].checked ? 'True' : 'False';

        setParamAjax(value, $('#cbLogEnabled').parent()[0], null);
    });
   
  $('#cbAdditionalData')
    .bind('click', function(e) {
       
        var value = $('#cbAdditionalData')[0].checked ? 'True' : 'False';

        setParamAjax(value, $('#cbAdditionalData').parent()[0], null);
    });
   
    function onScreenResolutionChange(rb)
    {
        var srcId  = this.id.substr(10);
        var postData = "spa=1"+"&cat=SYSTEM&name=SCREEN_RESOLUTION&value="+srcId;

        var post = callAjax(postData);
        checkPostResult(post);       
    }

    function rebootServer(e) {
        if(confirm('Are you sure you want to Restart your server ?')!=true)
            return false;
       
        var rVal = emsAction('reboot',e);
        return rVal;
    }
   
   $(document).ready(function() {
        initValidation(true);
       
        initStatusRefreshMonitor();
       
        if ($.browser.msie) {
            $("#lbSysTimeZone").mousedown(function(){       
               $(this).css("width","auto");       
            });
       
            $("#lbSysTimeZone").change(function(){       
               $(this).css("width","300px");
               timeZoneChanged();
            });   
       
            $("#lbSysTimeZone").blur(function(){       
               $(this).css("width","300px");
            });
        }
        else {
            $("#lbSysTimeZone").change(function(){       
               timeZoneChanged();
            });   
        }
       
        $(".screenResolution").click( onScreenResolutionChange );

       
        getTime();
   });
</script>


</body>
</html>

http://nerdhome.jimdo.com

Posted on
Sat Oct 31, 2015 3:29 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: I need some help clicking a button on a web page.

That's an interesting one :)

Unfortunately what happens when you click the first button is this:

Code: Select all
function rebootServer(e)
{
        if(confirm('Are you sure you want to Restart your server ?')!=true)
            return false;
       
        var rVal = emsAction('reboot',e);
        return rVal;
}

If you press Yes, then it ultimately calls a function called emsAction() - but that isn't defined anywhere in the code you've provided, so it must be defined in one of the imported javascript files.

Therefore I don't think you're going to solve the problem this way.

Some Nuvo MusicPorts do support telnet access, but it depends on your skill level whether you want to go that far :)

I guess your Applescript route is possibly the right one, but I know zero applescript so can't help you there.

Peter

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 6 guests