Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7037973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:36:46+00:00 2026-05-28T01:36:46+00:00

My list is nested under two headers and I don’t know how to access

  • 0

My list is nested under two headers and I don’t know how to access them via watir since the style, display is set to “none” until a “hover” event occurs. And the class isn’t defined until a hover/mousveover either.

b.link(:text, /Assessments/).fire_event('onmouseover')

will open the initial drop-down. I have no idea how to access the elements in the “sub-level”

Variations on the following are rejected by watir:

b.link(:class, "sub-level").click
b.link(:class, "sub-level").fire_event('onmouseover')
b.link(:class, "sub-level").fire_event('hover')

Watir::Exception::UnknownObjectException: unable to locate element, using {:class=>"sub-level", :tag_name=>"a"}

I’ve been running this through IRB for quick testing of each new line I add to my script. If this is incorrect, I would appreciate any advice.

<li class="top-level">
<a class="" href="#">
Assessments&nbsp;&nbsp;
<img id="lfArrowImg" style="border:0px;" src="https://test.com/top/images/global_nav_downArrow.gif">
</a>
  <ul style="z-index: 1045; display: none;">
  <li class="sub-level">
     <a class="">
     Assessments
     <div id="menugroup" class="dr-menu-node dr-menu-node-icon rich-menu-item-folder rich-menu-group-folder"></div>
     </a>
  <ul style="z-index: 1068; display: none;">    
  <li class="sub-level">
     <a class="" href="http://test.com/content/aa/assessment/index.xhtml">Main</a>
  </li>
  <li class="sub-level">
  <li class="sub-level">
</ul>
</li>

Thanks,
Damien

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:36:47+00:00Added an answer on May 28, 2026 at 1:36 am

    The error is correct since you have no link tag in that code with a class of sub-level. The things with that class are li (List Item) elements which contain link elements (aka ‘anchor’ hence the a tag)

    Try something like this (depending on which link you want to click)

    browser.li(:class => 'sub-level', :text => 'Assessments').link.click
    browser.li(:class => 'sub-level', :text => 'Main').link.click
    

    For more on ways to identify elements, especially if they do not have a handy ID, Class etc, see the answers to this SO question: How to get index of parent element using Watir Webdriver? and the answers (all three) to this question also: Accessing an element with no attributes in Watir

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to display custom categories with their sub-categories in a nested list. This
I am trying to copy the nested list a , but do not know
I have a nested list like this: <ul class=list> <li class=list_item_type_1> <ul class=list> <li
I have a nested list comprising ~30,000 sub-lists, each with three entries, e.g., nested_list
I have a nested list something like this: PLACES = ( ('CA', 'Canada', (
I have created a nested list with drag/drop functionality. My issue is that I
How can I count nested list elements in Prolog? I have the following predicates
How would I create a nested list, I currently have this public function getNav($cat,$subcat){
I have a nested unsorted list and I want to place a click event
I have a nested oredered list which i m animating using this code... var

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.