Having issue with storeAttrebute

I have a Lef Navigation
Need to extract a Title from each <a></a>
I have N number of links. .Have extracted total number of xPath (//ul[@id="sidebar-menu"]//div[@class="sidebar-submenu"]//a)).
Using the storeAttribute attempting to extract a Title

store |//ul[@id=“sidebar-menu”]//div[@class=“sidebar-submenu”]//a | menu_xpath
Tried multiple versions of this code

  • storeAttribute |(${menu_xpath})@title[${!times}] | menu_title
  • storeAttribute |(${menu_xpath})[${!times}]@title | menu_title
  • storeAttribute |(${menu_xpath}[${!times}])@title | menu_title
    Getting same error al over timeout reached when looking for element '(//ul[@id="sidebar-menu"]//div[@class="sidebar-submenu"]//a[1])'

Here is a sample Page

<html>
  <head>
    <meta name="generator"
    content="HTML Tidy for HTML5 (experimental) for Windows https://github.com/w3c/tidy-html5/tree/c63cc39" />
    <title></title>
  </head>
  <body>
    <ul id="sidebar-menu">
      <li class="otp_menu sfHover">
        <a href="#" title="Payments" class="sf-with-ul">
          <span>Payments</span>
        </a>
        <div class="sidebar-submenu" style="display: block;">
          <ul>
            <li class="otp">
              <a href="v1.do?v1=otp-cxinfo.do&amp;newBean=true&amp; title="Make Payment">
                <span>Make Payment</span>
              </a>
            </li>
            <li class="otp-cp">
              <a href="v1.do?v1=otp-cxinfo.do&amp;newBean=true&amp;useCardPresentDedicatedFlow=true&amp; title="Make Card-Present Payment">
                <span>Make Card-Present Payment</span>
              </a>
            </li>
            <li class="motp">
              <a href="v1.do?v1=mp-init.do&amp;newBean=true&amp; title="Pay Multiple Accounts">
                <span>Pay Multiple Accounts</span>
              </a>
            </li>
            <li class="irefund">
              <a href="v1.do?v1=irefund-cxinfo.do&amp;newBean=true&amp; title="Make Refund">
                <span>Make Refund</span>
              </a>
            </li>
            <li class="ps">
              <a href="v1.do?v1=payment-search.do&amp;newBean=true&amp; title="Find Payment">
                <span>Find Payment</span>
              </a>
            </li>
            <li class="unsuspend">
              <a href="search-suspended-payment-method.do? title="Unsuspend a Payment Method">
                <span>Unsuspend a Payment Method</span>
              </a>
            </li>
            <li class="velocity">
              <a href="v1.do?v1=payment-velocity-search.do&amp;newBean=true&amp; title="Find Payment Velocity">
                <span>Find Payment Velocity</span>
              </a>
            </li>
          </ul>
        </div>
      </li>
      <li class="scheduled_menu">
        <a href="#" title="AutoPay" class="sf-with-ul">
          <span>AutoPay</span>
        </a>
        <div class="sidebar-submenu"">
          <ul>
            <li class="sp">
              <a href="v1.do?v1=schedule-customer-search.do&amp;newBean=true&amp; title="Schedule Payment">
                <span>Schedule Payment</span>
              </a>
            </li>
            <li class="ss">
              <a href="v1.do?v1=schedule-search.do&amp;newBean=true&amp; title="Find Payment Schedule">
                <span>Find Payment Schedule</span>
              </a>
            </li>
            <li class="pap">
              <a href="v1.do?v1=preauth-start.do&amp;newBean=true&amp; title="Preauthorize Payment">
                <span>Preauthorize Payment</span>
              </a>
            </li>
            <li class="proa">
              <a href="v1.do?v1=proactive-customer-search.do&amp;newBean=true&amp; title="Make Proactive Payment">
                <span>Make Proactive Payment</span>
              </a>
            </li>
            <li class="pros">
              <a href="v1.do?v1=proactive-search.do&amp;newBean=true&amp; title="Find Proactive Payment">
                <span>Find Proactive Payment</span>
              </a>
            </li>
          </ul>
        </div>
      </li>
      <li class="user_menu">
        <a href="#" title="User Management" class="sf-with-ul">
          <span>User Management</span>
        </a>
        <div class="sidebar-submenu"">
          <ul>
            <li class="u">
              <a href="#" title="Users" class="sf-with-ul">
                <span>Users</span>
              </a>
              <div class="sidebar-submenu tertiarymenu"">
                <ul>
                  <li class="au">
                    <a href="v1.do?v1=user-menu.do&amp;operation=menu&amp; title="Add User">
                      <span>Add User</span>
                    </a>
                  </li>
                  <li class="su">
                    <a href="v1.do?v1=user-search.do&amp;newBean=true&amp; title="Find User">
                      <span>Find User</span>
                    </a>
                  </li>
                </ul>
              </div>
            </li>
            <li class="c">
              <a href="#" title="Customers" class="sf-with-ul">
                <span>Customers</span>
              </a>
              <div class="sidebar-submenu tertiarymenu"">
                <ul>
                  <li class="ac">
                    <a href="v1.do?v1=customer-menu.do&amp;operation=menu&amp; title="Add Customer">
                      <span>Add Customer</span>
                    </a>
                  </li>
                  <li class="sc">
                    <a href="v1.do?v1=customer-search.do&amp;newBean=true&amp; title="Find Customer">
                      <span>Find Customer</span>
                    </a>
                  </li>
                </ul>
              </div>
            </li>
            <li class="g">
              <a href="#" title="Groups" class="sf-with-ul">
                <span>Groups</span>
              </a>
              <div class="sidebar-submenu tertiarymenu"">
                <ul>
                  <li class="ag">
                    <a href="v1.do?v1=group-menu.do&amp;operation=menu&amp; title="Add Group">
                      <span>Add Group</span>
                    </a>
                  </li>
                  <li class="sg">
                    <a href="v1.do?v1=group-search.do&amp;newBean=true&amp; title="Find Group">
                      <span>Find Group</span>
                    </a>
                  </li>
                </ul>
              </div>
            </li>
          </ul>
        </div>
      </li>
      <li class="cm_menu">
        <a href="#" title="Campaign Management" class="sf-with-ul">
          <span>Campaign Management</span>
        </a>
        <div class="sidebar-submenu"">
          <ul>
            <li class="ca">
              <a href="#" title="Add New Campaign" class="sf-with-ul">
                <span>Add New Campaign</span>
              </a>
              <div class="sidebar-submenu tertiarymenu"">
                <ul>
                  <li class="manual">
                    <a href="v1.do?v1=campaign-edit.do&amp;newBean=true&amp;operation=menu&amp; title="Manual Campaign">
                      <span>Manual Campaign</span>
                    </a>
                  </li>
                  <li class="quick">
                    <a href="v1.do?v1=campaign-qc-edit.do&amp;newBean=true&amp;operation=menu&amp; title="Quick Campaign">
                      <span>Quick Campaign</span>
                    </a>
                  </li>
                </ul>
              </div>
            </li>
            <li class="cs">
              <a href="v1.do?v1=campaign-search.do&amp;newBean=true&amp; title="Find Campaign">
                <span>Find Campaign</span>
              </a>
            </li>
          </ul>
        </div>
      </li>
    </ul>
  </body>
</html>

Here is a macro


    {
      "Command": "store",
      "Target": "//ul[@id=\"sidebar-menu\"]//div[@class=\"sidebar-submenu\"]//a",
      "Value": "menu_xpath",
      "Description": ""
    },
    {
      "Command": "storeXpathCount",
      "Target": "xpath=${menu_xpath}",
      "Value": "menu_count",
      "Description": ""
    },
    {
      "Command": "comment",
      "Target": "",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "times",
      "Target": "${menu_count}",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "storeAttribute",
      "Target": "(${menu_xpath})@title[${!times}]",
      "Value": "menu_title",
      "Description": "Not sure how to address this part"
    },
    {
      "Command": "echo",
      "Target": "${menu_title}",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "(${menu_xpath})[${!times}]",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": "",
      "Description": ""
    }

To extract the page title, simply use the store Title command :slight_smile:

Thanks for an advise, however, i was not asking about Page Title.

{
      "Command": "storeXpathCount",
      "Target": "xpath=//ul[@id=\"sidebar-menu\"]//div[@class=\"sidebar-submenu\"]//a",
      "Value": "menu_count",
      "Description": ""
    },
    {
      "Command": "times",
      "Target": "${menu_count}",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "xpath=(//ul[@id=\"sidebar-menu\"]//div[@class=\"sidebar-submenu\"]//a)[${!times}]",
      "Value": "menu_title",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "${menu_title}",
      "Value": "red",
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "xpath=(//ul[@id=\"sidebar-menu\"]//div[@class=\"sidebar-submenu\"]//a)[${!times}]",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": "",
      "Description": ""
    }

@uiuser Thanks for solution.
“Devil is in a details”