Sign in to follow this  
Followers 0
wazoo

Coding Newbie needs help with selecting from dropdown list

4 posts in this topic

Hey all,

Pretty new to coding and especially to AutoIt.

My application is pretty simple: I need to call up a web page with IE and select an option from the dropdown menu on the page. I've read through the examples and have created the following code to do it:

#include <IE.au3>
$oIE = _IECreate ("https://my.ooma.com/calling")
$oForm = _IEFormGetObjByName ($oIE, "0")
$oSelect = _IEFormElementGetObjByName ($oForm, "call_forwarding_settings_set[mode]")
    _IEFormElementOptionselect ($oSelect, "cf", 1, "byValue")

Problem is, the value is not switching from the default value. Here is, what I think, the relevant part of the source from the webpage:

<tr>
        <td colspan="2">
            <input name="call_forwarding_settings_set[enabled]" type="hidden" value="0" /><input checked="checked" id="call_forwarding_settings_set_enabled" name="call_forwarding_settings_set[enabled]" type="checkbox" value="1" /> <label for="call_forwarding_settings_set_enabled">Enable call forwarding</label>
        </td>
      </tr>
      <tr>
        <td style="padding-left: 10px;">
            <label class="right" for="call_forwarding_settings_set_mode">Forwarding mode</label>
        </td>
        <td>
            
            <select id="call_forwarding_settings_set_mode" name="call_forwarding_settings_set[mode]"><option value="no" selected="selected">Call forward on network outage</option>
<option value="cf">Call forward all</option>
<option value="mr">Multi-Ring</option></select>
        </td>
      </tr>

As you can probably tell by the code I've attempted to write, I'm trying to have the dropdown box select the option of "Call forward all". I've tried doing it with the ByText parameter substituting in "Call forward all" for the value of "cf" referenced in my code above.... but same result.

In addition, and I'm not sure if this is my problem, I could not find the name of the form in the source. So I ran the au3 script in the Examples directory which goes through a page and tells you how many forms there are and what their names are. When I ran it on the site I'm trying to manipulate, it told me one form with the name of "0". So that's what I put in the code.

Anyway... thanks for any help you all can give. ;)

Share this post


Link to post
Share on other sites



When I try your script with url https://my.ooma.com/calling

Ie redirect to https://my.ooma.com/home/login

and there is no dropdown menu ! Posted Image

Yeah... that's because it is an area you can only access as a member. Here's the entire source page if it is useful:

<!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" xmlns:fb="http://www.facebook.com/2008/fbml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="Cache-control" content="no-cache"/>
    <meta name = "format-detection" content = "telephone=no">
    <link rel="shortcut icon" href="/favicon.png" />
    <title>My Ooma - 
    Preferences - Call Forwarding
</title>
    
    <link href="/stylesheets/buttons.css?1271287907" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/layout.css?1271287907" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/main.css?1282247138" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/util.css?1280771394" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/ooma_icons.css?1282247138" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/ooma-theme/jquery-ui-1.7.2.custom.css?1271287907" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/errors.css?1271287907" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/jquery.gritter.css?1274910205" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/jquery.jgrowl.css?1274910205" media="screen" rel="stylesheet" type="text/css" />
    <script src="/javascripts/jquery-1.4.2.min.js?1279756511" type="text/javascript"></script>
<script src="/javascripts/jquery.form.js?1271287906" type="text/javascript"></script>
<script src="/javascripts/jquery.validate.min.js?1271287906" type="text/javascript"></script>
<script src="/javascripts/jquery.caret.js?1271287906" type="text/javascript"></script>
<script src="/javascripts/jquery-ui-1.7.2.custom.min.js?1271287906" type="text/javascript"></script>
<script src="/javascripts/jrails.js?1271287906" type="text/javascript"></script>
<script src="/javascripts/application.js?1283450706" type="text/javascript"></script>
<script src="/javascripts/jquery.md5.js?1271287906" type="text/javascript"></script>
<script src="/javascripts/wizard.js?1276732341" type="text/javascript"></script>
<script src="/javascripts/jquery.gritter.min.js?1274721409" type="text/javascript"></script>
<script src="/javascripts/jquery.jgrowl_minimized.js?1274910205" type="text/javascript"></script>
<script src="/javascripts/jquery.qtip-1.0.js?1279756511" type="text/javascript"></script>
    
    <!-- Chartbeat -->
    
    <script type="text/javascript">var _sf_startpt=(new Date()).getTime()</script>
    

<script type="text/javascript">
$(function() {
  $.extend($.gritter.options, {
          fade_in_speed: 200, // how fast notifications fade in (string or int)
          fade_out_speed: 200, // how fast the notices fade out
          time: 5000 // hang on the screen for...
  });

  $.jGrowl.defaults.position = 'center';
  
  $.fn.qtip.styles.contacts = {
    width: 200,
    //background: '#efd7a7',
    //color: 'black',
    textAlign: 'center',
    border: {
      width: 3,
      radius: 3
      //color: '#cdd3d7'
    },
    //tip: 'bottomLeft',
    tip: {
      corner: 'bottomLeft', // We declare our corner within the object using the corner sub-option
       //color: '#6699CC',
       size: {
          x: 10, // Be careful that the x and y values refer to coordinates on screen, not height or width.
          y : 8 // Depending on which corner your tooltip is at, x and y could mean either height or width!
       }
    },
    name: 'cream'
  }
  
  $.fn.qtip({
   position: {
    corner: {
     target: 'topMiddle',
     tooltip: 'bottomLeft'
    }
  }});

});



</script>

    
        <link href="/stylesheets/errors.css?1271287907" media="screen" rel="stylesheet" type="text/css" />
        <script type="text/javascript">
            function checkForwardingMode(id) {
                value = $('#' + id).val();
                if (value == 'no') {
                    $('#call_forwarding_prompt_td').hide();
                    $('#call_forwarding_settings_set_prompt').attr('checked', 0).attr('disabled', 1);
                } else {
                    $('#call_forwarding_prompt_td').show();
                    $('#call_forwarding_settings_set_prompt').attr('disabled', 0);
                }
            }
            $(document).ready(function() {
                checkForwardingMode('call_forwarding_settings_set_mode');
            });
        </script>
    
  </head>
  <body>
    <div id="wrapper">
      <div id="header" class="clear">
        <div class="column logo_block">
          <a href="/" class="logo">My Ooma</a>
        </div>
        <div class="column nav_block">
          <ul class="top-nav">
            <li id="nav_home" class=""><a href="/inbox">Home</a></li>
            <li id="nav_prefs" class="active"><a href="/voicemail">Preferences</a></li>
            <li id="nav_acc" class="">
              <a href="/account/services">Account</a>
            </li>
            <li id="nav_addons" class="">
              <a href="/products">Add-Ons</a>
            </li>
          </ul>
        </div>
        <div class="column user_block">
          <div class="column col-33">
            (949) 390-7251
          </div>
          <div class="column col-33">
            <a href="http://www.ooma.com/support">Support</a>
          </div>
          <div class="column col-33">
            <a href="/home/logout">Logout</a>
          </div>
        </div>
        <div class="column icon_block">
          <a href="http://www.ooma.com" class="icon"></a>
        </div>
      </div>
      <div id="main" class="clear">
        <div class="column" id="sidebar">
          <!--<div class="panel">-->
          <div class="left-top">
          </div>
          <div class="left-nav">
            
    <ul class="nav_list clearfix">
  <li class="nav_item "><a href="/voicemail">Voicemail</a></li>
  <li class="nav_item "><a href="/blacklists">Blacklists</a></li>
  <li class="nav_item active"><a href="/calling">Call Forwarding</a></li>
  <li class="nav_item "><a href="/phone_numbers">Phone Numbers</a></li>
    <li class="nav_item google_beta_sign "><a href="/google_voice">Google Voice</a></li>
  
    <li class="nav_item sip_beta_sign "><a href="/mobile">Ooma Mobile</a></li>
    
  <li class="nav_item "><a href="/privacy">Privacy</a></li>
    <li class="nav_item "><a href="/system">System</a></li>
  
    <li class="nav_item "><a href="/my_ooma">My Ooma</a></li>
  
</ul>
          </div>
          <div class="left-bottom"></div>
          <!--</div>-->
        </div>
        <div id="content" class="column">
          <div class="content-top">
            <em class="corner tl"><b>&bull;</b></em>
            <em class="corner tr"><b>&bull;</b></em>
          </div>
          <div class="content-main">
            <div id="flash_notice">                <div class="notice">
                  Logged in successfully
                </div>
</div>
            <div id="flash_error"></div>
            






    

    <div class="column col-75">
        <div class="panel">
            
            <div class="preferences calling_settings">
                <h1><img src='/images/MyOoma_crown_big.png' alt='Premier customer' /> Call Forwarding
                    Preferences <a class="ooma-icon-misc ooma-icon-question" title="Learn more" href="#" onclick='show_element("calling_help");return false;'/></a><div style="font-size:13px;color:#555;display: none; top: 100px; opacity: 1;" class="modal" id="calling_help"><div class="body"><div style="font-size:13px;padding-right:16px;font-weight:normal" class="content"><h2>Call Forwarding</h2>
<p>Your Ooma system can be setup to forward calls to any US phone number. You may select to:</p>
<ul class='bulletedlist'>
    <li><b>Call Forward on Internet Outage</b>: Forward calls only when your Ooma system is offline due to a local Internet outage.</li>
    <li><b>Call Forward All</b>: Forward all calls. Your home phones will not ring.</li>
    <li><b>Multi-Ring</b>: Incoming calls will ring your home phone AND be forwarded to the number configured. Answer the call on either phone.</li>
</ul>
<p>When answering forwarded calls, you'll be required to press "1" before accepting a call, unless you uncheck the "Require keypress..." option. Note: If you have Call Forward on Internet Outage selected, you will never hear a prompt before answering the call. A forwarded call that is not answered or accepted will roll into your Ooma voicemail.</p>
<p>For best results, we recommend configuring a voicemail pickup time of at least 24 seconds (default).  If you configure your voicemail pickup time to be less than 24 seconds, Ooma's voicemail may answer the call before you can answer the forwarded call.  To adjust your voicemail settings, go to <a href="/voicemail/">voicemail preference</a> page.</p>
<p style='text-align:center'><input type='submit' value='Close' style='width=200px;font-size:12px' onclick='hide_element("calling_help");return false;'/></div></div><div class='foot'></div></div></h1>

                <div class="hr"><hr/></div>
                
                <div id="calling_settings_container">
                    <form action="/calling/save" class="edit_call_forwarding_settings_set" id="edit_call_forwarding_settings_set_1123" method="post"><div style="margin:0;padding:0"><input name="_method" type="hidden" value="put" /><input name="authenticity_token" type="hidden" value="eHPM3tREVwZ6Cm85E/h6yaT4Wx0U=" /></div>
    <table cellspacing=5 style="margin:10px 0 15px 0">
      
      <tr>
        <td colspan="2">
            Phone Number: <select id="device_forwarding_mode_setting" name="device[forwarding_mode_setting]" onchange="$.ajax({data:'vnum_id=' + this.value + '&amp;authenticity_token=' + encodeURIComponent('eHPM39iCCOO6Cm85E/h6yaTD4Wx0U='), dataType:'script', type:'post', url:'/calling/change_number'})"><option value="all numbers" selected="selected">All Numbers</option>
<option value="0">(949) 390-7251</option>
<option value="1">(949) 390-7252</option></select>
        </td>
      </tr>
      

      <tr>
        <td colspan="2">
            <input name="call_forwarding_settings_set[enabled]" type="hidden" value="0" /><input checked="checked" id="call_forwarding_settings_set_enabled" name="call_forwarding_settings_set[enabled]" type="checkbox" value="1" /> <label for="call_forwarding_settings_set_enabled">Enable call forwarding</label>
        </td>
      </tr>
      <tr>
        <td style="padding-left: 10px;">
            <label class="right" for="call_forwarding_settings_set_mode">Forwarding mode</label>
        </td>
        <td>
            
            <select id="call_forwarding_settings_set_mode" name="call_forwarding_settings_set[mode]"><option value="no" selected="selected">Call forward on network outage</option>
<option value="cf">Call forward all</option>
<option value="mr">Multi-Ring</option></select>
        </td>
      </tr>
      <tr>
        <td style="padding-left: 10px;vertical-align:top;width:120px">
            <label class="right" for="call_forwarding_settings_set_number">Forwarding number</label>
        </td>
        <td>
            <input id="call_forwarding_settings_set_number" name="call_forwarding_settings_set[number]" size="30" type="text" value="(714) 8xx-xxxx" /><br/>
            <div class="ex">Ex: 650-555-1234</div>
        </td>
      </tr>
      
      <tr style="display:none;">
        <td colspan="2" id="call_forwarding_prompt_td">
            <input name="call_forwarding_settings_set[prompt]" type="hidden" value="0" /><input id="call_forwarding_settings_set_prompt" name="call_forwarding_settings_set[prompt]" type="checkbox" value="1" />
            <label for="call_forwarding_settings_set_prompt">Require key press before answering forwarded calls</label>
        </td>
      </tr>
  </table>
  <script type="text/javascript">
//<![CDATA[
$('#call_forwarding_settings_set_mode').delayedObserver(0.1, function(element, value) {checkForwardingMode('call_forwarding_settings_set_mode')})
//]]>
</script>
  <div class="hr"><hr/></div><br/>
  <input class="ooma-dialog-button" id="commit" name="commit" type="submit" value="Save" />
</form>
                </div>
            </div>
        </div>
    </div>

    <div class="right links block item">
        <i class="corner tl"></i>
        <i class="corner tr"></i>

        <p><strong>Call forwarding</strong> allows you to answer your Ooma calls away from
            home. Choose what type of forwarding you would like:</p>

        <p><strong>Multi-Ring</strong> will ring your home phone and a number of your
            choice when you receive a call. Answer at either location.</p>

        <p><strong>Call forward all</strong> will ring the number of your choice when you
            receive a call. Your home phone will not ring.</p>

        <p><strong>Call forward on network outage</strong> will only ring the number of
            your choice when your Ooma system is offline or when your Internet
            connection is down. </p>

        
        <div class="bottom_shadow"></div>
    </div>


          </div>
          <div class="content-bottom">
            <em class="corner bl"><b>&bull;</b></em>
            <em class="corner br"><b>&bull;</b></em>
          </div>
        </div>
      </div>

      <div id="footer" style="margin-top:3px">
        <ul class="left" style="padding-left:165px;">

          <li class="first"><a href="http://blog.ooma.com/">Blog</a></li>
          <li><a href="http://forums.ooma.com/">Forums</a></li>
          <li><a href="http://forums.ooma.com/viewtopic.php?f=10&t=26">Status</a></li>
          <li><a href="http://www.ooma.com/media/in-the-news">News & Media</a></li>
          <li><a href="http://www.ooma.com/buy/find-a-live-demo">Events</a></li>
          <li><a href="http://www.ooma.com/media/awards">Awards</a></li>
          <li><a href="http://www.ooma.com/contact">Contact</a></li>
          <li><a href="http://www.ooma.com/legal/">Legal</a></li>
        </ul>
        <ul class="right">
          <li class="first"><a href="http://www.ooma.com/legal/">Copyright &copy; 2007-2010 Ooma, Inc. All rights reserved.</a></li>
        </ul>
        <div class="clear"></div>
      </div>

      <div class="clear">
      </div>
      <div id="loader" class="hidden">
        <div class="loader-top">
        </div>
        <div class="loader-middle">
          <img src="/images/loader.gif" />Loading...
        </div>
        <div class="loader-bottom">
        </div>
      </div>
    </div>
    
    <script type="text/javascript" language="javascript">
  $(document).ready(function() {
    // when the close button at right corner of the message box is clicked
    $('#close_message').click(function() {
      $('#float_message').animate({ bottom:"+=5px",opacity:0 }, "slow");
      // set cookie for float message
      var date = new Date();
      var days = 1; // one day
      date.setTime(date.getTime()+(days*24*60*60*1000));
      var nextWeek = date.toGMTString();
      //var nextWeek = "
      document.cookie = "no_float_message_1005=true; expires=" + nextWeek;
    });
  });
</script>
  <div class="notice" id="float_message">
    <div class="right">
      <a href="#" id="close_message">Close</a>
    </div>
  
  
  <a href="/intl_bundle?utm_campaign=intl_bundle&amp;utm_medium=myooma&amp;utm_source=toolbar&amp;utm_content=calling_overseas">Calling overseas? Call 70 countries for 1¢ per minute.</a>

    
    
  </div>

    
  
    
    <!-- Chartbeat -->
    <script type="text/javascript">
    var _sf_async_config={uid:2363,domain:"my.ooma.com"};
    (function(){
      function loadChartbeat() {
        window._sf_endpt=(new Date()).getTime();
        var e = document.createElement('script');
        e.setAttribute('language', 'javascript');
        e.setAttribute('type', 'text/javascript');
        e.setAttribute('src',
           (("https:" == document.location.protocol) ? "https://s3.amazonaws.com/" : "http://") +
           "static.chartbeat.com/js/chartbeat.js");
        document.body.appendChild(e);
      }
      var oldonload = window.onload;
      window.onload = (typeof window.onload != 'function') ?
         loadChartbeat : function() { oldonload(); loadChartbeat(); };
    })();
    </script>
    

    <!-- Google Analytics -->
        <script type="text/javascript">
        var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
        document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
        </script>
        
        
        
        <script type="text/javascript">
        try {
            var pageTracker = _gat._getTracker("UA-11400655-1");
                        pageTracker._setCustomVar(1, "Service Level", "Premier, Free Trial", 2);
            
                pageTracker._trackPageview();
            
            
            
            } catch(err) {}
        </script>

  </body>
</html>

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

It allways crash : --> IE.au3 V2.4-0 Warning from function _IEFormGetObjByName, $_IEStatus_NoMatch

$oForm = _IEFormGetObjByName ( $oIE, "0" ) is not good,

may be it's a security for the website to not give a name to the form ! Posted Image

Edited by wakillon

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

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