1

Assume the following DOM fragment:

    <div id="ctl00_mainContent_ddl_destinationStation1_CTNR" class="search_options_menucontentbg" style="z-index: 999999; display: block;">
    <div id="glsctl00_mainContent_ddl_destinationStation1_CTNR">
    <a id="closebtn" class="close-btn close" href="#">X</a>
    <table id="citydropdown" cellspacing="0" cellpadding="0" border="0" width="700">
      <tbody>
        <tr>
        <tr>
           <td class="leftbg"/>
           <td class="mapbg">
              <div class="btnrow">
                 <div class="heading"/>
                 <div class="search_options_menucontent" align="center" border="0" width="100%">
                    <div id="dropdownGroup1">
                       <h3 class="title1">India</h3>
                       <div class="dropdownDiv">
                       <ul>
                          <li class="city_selected ">
                             <a class="" value="IXB" text="Bagdogra (IXB)" onclick="javascript:$CityDropDown.SetSelectedValue(this);return false;" tooltip="" href="#"> Bagdogra (IXB)</a>
                         </li>
                         <li class="">
                            <a class="" value="BLR" text="Bengaluru (BLR)" onclick="javascript:$CityDropDown.SetSelectedValue(this);return false;" tooltip="" href="#"> Bengaluru (BLR)</a>
                         </li>
                         <li class="">
                           <a class="" value="MAA" text="Chennai (MAA)" onclick="javascript:$CityDropDown.SetSelectedValue(this);return false;" tooltip="" href="#"> Chennai (MAA)</a>

How do I traverse from node starting with <div id="ctl00_mainContent_ddl_destinationStation1_CTNR" to <a class="" value="IXB" text="Bagdogra (IXB)"?

closed as unclear what you're asking by Paul Muir, IAmMilinPatel, Kate Paulk, Bharat Mane, Niels van Reijmersdal May 1 '16 at 13:09

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • just and additional note-I want to traverse from node starting from <div id="ctl00_mainContent_ddl_destinationStation1_CTNR" to a web element- <a class="" value="IXB" text="Bagdogra (IXB)" – Abhishek Apr 26 '16 at 2:33
  • Please provide your output element. Which you wanted to find. – Sagar007 Apr 26 '16 at 8:43
  • Please provide some information, and a question. What element are you wanting to traverse to from which element? The more information you provide the better answer you will get. – Paul Muir Apr 26 '16 at 11:29
1

First off, either you mistyped the HTML or the HTML is malformed -- note the two consecutive <tr> tags.

That aside, rather than answer the question, I suggest you look at this StackOverflow question on using sibling operators in XPath.

Not the answer you're looking for? Browse other questions tagged or ask your own question.