frost87

Clicking a Label on a webpage

2 posts in this topic

Hi folks,

I'm new to AutoIt as of yesterday. I'm attempting to automate a webpage login (of our ipPhones), click through a few links, change a few options, save and logout. I then plan to repeat this for all our IP phones on site.

I've managed to get the page to load, enter the login information and password and click login. That works a treat using _IE.

The next step is to simply (or at looks as if it should be) click on a label that is a link. However i'm really struggling as it isn't actually classified as a button/hyperlink.

In the example below, how would i go about clicking one of the List elements labels (specifically the one labelled "Directory")? I've tried multiple examples of click by ID, click by value, looping round hyperlinks (couldnt see it as a hyperlink). I've run out of ideas.

Could anyone lend a hand?

Many, many thanks for anyone that could help! :)

 

<div class="main-menu"> 
      
      <div class="header-blank"><div class="logoff"><label onmouseover="onNavMouseover(this);" onmouseout="onNavMouseout(this);" onclick="gotoPage('/servlet?p=login&q=logout');"><script>T("Log_Out");</script></label></div></div>
      
      <ul>
        <li id="status" showlevel=",menu">
          <div class="left-side"></div>
          <div class="tab-content"><label onmouseover="onNavMouseover(this);" onmouseout="onNavMouseout(this);" onclick="gotoPage('/servlet?p=status&q=load');"><script>T("Status");</script></label></div>
          <div class="right-side"></div>
        </li>
        <li id="account" showlevel=",menu">
          <div class="left-side"></div>
          
          <div class="tab-content" ><label onmouseover="onNavMouseover(this);" onmouseout="onNavMouseout(this);" onclick="gotoPage('/servlet?p=account-register&q=load');"><script>T("Account");</script></label></div>
          
          <div class="right-side"></div>
        </li>
        <li id="network" showlevel=",menu">
          <div class="left-side"></div>
          <div class="tab-content"><label onmouseover="onNavMouseover(this);" onmouseout="onNavMouseout(this);" onclick="gotoPage('/servlet?p=network&q=load');"><script>T("Network");</script></label></div>
          <div class="right-side"></div>
        </li>
        
        <li id="dsskey" showlevel=",menu" >
         <div class="left-side"></div>
         <div class="tab-content"><label onmouseover="onNavMouseover(this);" onmouseout="onNavMouseout(this);" onclick="gotoDsskeyPage();"><script>T("Dsskey");</script></label></div>
         <div class="right-side"></div>
        </li>
        
        
        <li id="features" showlevel=",menu" >
          <div class="left-side"></div>
          <div class="tab-content"><label onmouseover="onNavMouseover(this);" onmouseout="onNavMouseout(this);" onclick="gotoPage('/servlet?p=features-forward&q=load');"><script>T("Features");</script></label></div>
          <div class="right-side"></div>
        </li>
        
        <li id="settings" showlevel=",menu" >
          <div class="left-side"></div>
          <div class="tab-content"><label onmouseover="onNavMouseover(this);" onmouseout="onNavMouseout(this);" onclick="gotoPage('/servlet?p=settings-preference&q=load');"><script>T("Settings");</script></label></div>
          <div class="right-side"></div>
        </li>
        
        <li id="contacts" showlevel=",menu" >
          <div class="left-side"></div>
          <div class="tab-content"><label onmouseover="onNavMouseover(this);" onmouseout="onNavMouseout(this);" onclick="gotoPage('/servlet?p=contactsbasic&q=load&num=1&group=');"><script>T("Directory");</script></label></div>
          <div class="right-side"></div>
        </li>

 

Share this post


Link to post
Share on other sites



Either of these should work:

$oLinks = _IETagNameGetCollection ($oIE, 'label')

For $oLink in $oLinks
    ;~ Example 1
    If $oLink.getAttributeNode('onclick').NodeValue = "gotoPage('/servlet?p=contactsbasic&q=load&num=1&group=');" Then
        _IEAction($oLink, 'click')
    EndIf
    ;~ Example 2
    ;~ If StringInStr($oLink.InnerText, 'Directory') Then
    ;~  If $oLink.getAttributeNode('onclick').NodeValue = "gotoPage('/servlet?p=contactsbasic&q=load&num=1&group=');" Then
    ;~      _IEAction($oLink, 'click')
    ;~  EndIf
    ;~ EndIf
Next

 

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