title: Relative Xpath from list of WebElements
body: <p>Is it possible to use a relative xpath after I've gathered a list of WebElements? If so what's the best way to do it? </p>
  
  <p>This is what I have:</p>
  
  <pre><code>List &lt;WebElement&gt; rows = driver.findElements(By.xpath(rowsXpath));
  int j = 1;
  boolean foundCollector = false;
  for(WebElement e : rows) {
      String c = e.findElement(By.xpath("(//tbody)[" + j + "]//u[text()=\"" + collector + "\"])")).getText();
      if(c.equals(collector)) {
          foundCollector = true;
          break;
      }
      ++j;
  }
  </code></pre>
  
  <p>the list rows contains individual rows with multiple columns and I'm trying to find the row which contains a particular name in a column. Within my for loop I was trying to use a relative xpath to look for an element, is this even possible? Or do I need to provide the whole xpath I used to find the rows with the additional xpath for the individual divs? </p>
  
  <p>I'm not guaranteed the order of the columns which is why I have to do it this way.</p>
  
  <p>This is the xpath I used to obtain the rows:</p>
  
  <pre><code>String rowsXpath = "//div[@id=\"QosDashpardPanelBottom\"]//div[@id=\"CollectorQoSPerformanceMetricsgrid\"]//div[contains(@class, \"x-grid3-row  x-unselectable-single\")]";
  </code></pre>
  
  <p>Here's the HTML:</p>
  
  <pre><code>&lt;body class=" ext-gecko ext-windows" onload="processLoaders();"&gt;
  &lt;script type="text/javascript"&gt;
  &lt;div id="topNavDiv" style="height: 90px"&gt;
  &lt;div id="bodyContentOuter" style="width: 1280px; height: 587px;"&gt;
      &lt;div id="bodyContentInner"&gt;
          &lt;script src="RLT/RLT.nocache.js" language="javascript" type="text/javascript"&gt;
          &lt;script defer="defer"&gt;
          &lt;script language="javascript" type="text/javascript"&gt;
          &lt;div id="rtcpMain" class=" x-component x-border-layout-ct" style="width: 1280px; height: 587px;"&gt;
              &lt;div id="rtcpMainWest" class=" x-panel x-component x-border-panel" style="left: 5px; top: 5px; width: 225px;"&gt;
              &lt;div id="x-auto-2" class=" x-tab-panel x-component x-border-panel" tabindex="0" hidefocus="true" style="left: 235px; top: 5px; width: 1040px;"&gt;
                  &lt;div class="x-tab-panel-header x-unselectable" style="width: 1038px;" unselectable="on"&gt;
                  &lt;div class="tone-rtcp-tabbed-content-panel" style="width: 1040px; height: 550px;"&gt;
                      &lt;div id="x-auto-10" class=" x-component" style="overflow: auto; width: 1040px; height: 550px;"&gt;
                          &lt;div id="QosDashboardPanel0" class=" x-panel x-component" style="width: 1040px;"&gt;
                              &lt;div id="x-auto-13" class=" x-small-editor x-panel-header x-component x-hide-display" role="presentation"&gt;
                              &lt;div id="rtcpDPBWrap" class="x-panel-bwrap" role="presentation" style="overflow: visible;"&gt;
                                  &lt;div class="x-panel-tbar x-panel-tbar-noheader" role="presentation" style="width: 1040px;"&gt;
                                  &lt;div id="rtcpDPBody" class="x-panel-body x-panel-body-noheader x-border-layout-ct" role="presentation" style="width: 1038px; height: 700px;"&gt;
                                      &lt;div id="QosDashboardPanelTop" class=" x-component x-border-panel x-border-layout-ct" style="left: 0px; top: 0px; width: 1038px; height: 400px;"&gt;
                                      &lt;div id="QosDashpardPanelBottom" class=" x-component x-border-panel x-border-layout-ct" style="left: 1px; top: 401px; width: 1036px; height: 298px;"&gt;
                                          &lt;div id="QosDashpardPanel_pqosChartsLC" class=" x-component x-border-panel x-border-layout-ct x-hide-display" style="left: 0px; top: 0px; width: 1036px; height: 400px;"&gt;
                                          &lt;div id="QosDashpardPanel_metricsTablesLC" class=" x-component x-border-panel x-border-layout-ct" style="left: 1px; top: 1px; width: 1034px; height: 296px;"&gt;
                                              &lt;div id="CollectorMetrics_toneletWrapper" class=" x-panel x-component x-border-panel" style="left: 1px; top: 1px; width: 330px;"&gt;
                                                  &lt;div id="x-auto-99" class=" x-small-editor x-panel-header x-component x-hide-display" role="presentation"&gt;
                                                  &lt;div class="x-panel-bwrap" role="presentation"&gt;
                                                      &lt;div class="x-panel-body x-panel-body-noheader" role="presentation" style="width: 328px; height: 292px;"&gt;
                                                          &lt;div id="CollectorMetrics" class=" x-panel x-component" style="width: 328px;"&gt;
                                                              &lt;div id="x-auto-109" class=" x-small-editor x-panel-header x-component x-unselectable" role="presentation" unselectable="on"&gt;
                                                              &lt;div class="x-panel-bwrap" role="presentation"&gt;
                                                                  &lt;div class="x-panel-body" role="presentation" style="width: 326px; height: 265px;"&gt;
                                                                      &lt;div id="CollectorQoSPerformanceMetricsgrid" class=" x-grid-panel x-component" style="position: relative; width: 326px; height: 265px;" tabindex="0" hidefocus="true" unselectable=""&gt;
                                                                          &lt;div class="x-grid3" role="presentation" style="width: 326px; height: 265px;"&gt;
                                                                              &lt;div class="x-grid3-viewport" role="presentation"&gt;
                                                                                  &lt;div class="x-grid3-header" role="presentation"&gt;
                                                                                  &lt;div class="x-grid3-scroller" role="presentation" style="width: 326px; height: 243px;"&gt;
                                                                                      &lt;div class="x-grid3-body" role="presentation"&gt;
                                                                                          &lt;div id="CollectorQoSPerformanceMetricsgrid_x-auto-633" class="x-grid3-row x-unselectable-single x-grid3-row-selected x-grid3-highlightrow " style="width:510px;"&gt;
                                                                                              &lt;table class="x-grid3-row-table" cellspacing="0" cellpadding="0" border="0" style="width:510px;" role="presentation"&gt;
                                                                                                  &lt;tbody role="presentation"&gt;
                                                                                                      &lt;tr role="presentation"&gt;
                                                                                                          &lt;td id="x-auto-634" class="x-grid3-col x-grid3-cell x-grid3-td-name x-grid-cell-first " style="width:148px;" role="gridcell"&gt;
                                                                                                              &lt;div class="x-grid3-cell-inner x-grid3-col-name" unselectable="on"&gt;
                                                                                                                  &lt;u&gt;Lync&lt;/u&gt;
                                                                                                              &lt;/div&gt;
                                                                                                          &lt;/td&gt;
                                                                                                          &lt;td id="x-auto-635" class="x-grid3-col x-grid3-cell x-grid3-td-badCalls " style="width:53px;" role="gridcell"&gt;
                                                                                                              &lt;div class="x-grid3-cell-inner x-grid3-col-badCalls" unselectable="on"&gt;36&lt;/div&gt;
                                                                                                          &lt;/td&gt;
                                                                                                          &lt;td id="x-auto-636" class="x-grid3-col x-grid3-cell x-grid3-td-totalCalls " style="width:58px;" role="gridcell"&gt;
                                                                                                              &lt;div class="x-grid3-cell-inner x-grid3-col-totalCalls" unselectable="on"&gt;120&lt;/div&gt;
                                                                                                          &lt;/td&gt;
                                                                                                          &lt;td id="x-auto-637" class="x-grid3-col x-grid3-cell x-grid3-td-avgLatency " style="width:73px;" role="gridcell"&gt;
                                                                                                              &lt;div class="x-grid3-cell-inner x-grid3-col-avgLatency" unselectable="on"&gt;223&lt;/div&gt;
                                                                                                          &lt;/td&gt;
                                                                                                          &lt;td id="x-auto-638" class="x-grid3-col x-grid3-cell x-grid3-td-avgLoss " style="width:53px;" role="gridcell"&gt;
                                                                                                              &lt;div class="x-grid3-cell-inner x-grid3-col-avgLoss" unselectable="on"&gt;0.80&lt;/div&gt;
                                                                                                          &lt;/td&gt;
                                                                                                          &lt;td id="x-auto-639" class="x-grid3-col x-grid3-cell x-grid3-td-avgJitter " style="width:58px;" role="gridcell"&gt;
                                                                                                              &lt;div class="x-grid3-cell-inner x-grid3-col-avgJitter" unselectable="on"&gt;29&lt;/div&gt;
                                                                                                          &lt;/td&gt;
                                                                                                          &lt;td id="x-auto-640" class="x-grid3-col x-grid3-cell x-grid3-td-avgMOS x-grid3-cell-last " style="width:53px;" role="gridcell"&gt;
                                                                                                              &lt;div class="x-grid3-cell-inner x-grid3-col-avgMOS" unselectable="on"&gt;3.86&lt;/div&gt;
                                                                                                          &lt;/td&gt;
                                                                                                      &lt;/tr&gt;
                                                                                                  &lt;/tbody&gt;
                                                                                              &lt;/table&gt;
                                                                                          &lt;/div&gt;
                                                                                          &lt;div id="CollectorQoSPerformanceMetricsgrid_x-auto-641" class="x-grid3-row x-unselectable-single " style="width:510px;"&gt;
                                                                                              &lt;table class="x-grid3-row-table" cellspacing="0" cellpadding="0" border="0" style="width:510px;" role="presentation"&gt;
                                                                                                  &lt;tbody role="presentation"&gt;
                                                                                                      &lt;tr role="presentation"&gt;
                                                                                                      &lt;td id="x-auto-642" class="x-grid3-col x-grid3-cell x-grid3-td-name x-grid-cell-first " style="width:148px;" role="gridcell"&gt;
                                                                                                          &lt;div class="x-grid3-cell-inner x-grid3-col-name" unselectable="on"&gt;
                                                                                                              &lt;u&gt;CUCM-Publisher&lt;/u&gt;
                                                                                                          &lt;/div&gt;
                                                                                                      &lt;/td&gt;
                                                                                                      &lt;td id="x-auto-643" class="x-grid3-col x-grid3-cell x-grid3-td-badCalls " style="width:53px;" role="gridcell"&gt;
                                                                                                          &lt;div class="x-grid3-cell-inner x-grid3-col-badCalls" unselectable="on"&gt;3&lt;/div&gt;
                                                                                                      &lt;/td&gt;
                                                                                                      &lt;td id="x-auto-644" class="x-grid3-col x-grid3-cell x-grid3-td-totalCalls " style="width:58px;" role="gridcell"&gt;
                                                                                                          &lt;div class="x-grid3-cell-inner x-grid3-col-totalCalls" unselectable="on"&gt;52&lt;/div&gt;
                                                                                                      &lt;/td&gt;
                                                                                                      &lt;td id="x-auto-645" class="x-grid3-col x-grid3-cell x-grid3-td-avgLatency " style="width:73px;" role="gridcell"&gt;
                                                                                                          &lt;div class="x-grid3-cell-inner x-grid3-col-avgLatency" unselectable="on"&gt;190&lt;/div&gt;
                                                                                                      &lt;/td&gt;
                                                                                                      &lt;td id="x-auto-646" class="x-grid3-col x-grid3-cell x-grid3-td-avgLoss " style="width:53px;" role="gridcell"&gt;
                                                                                                          &lt;div class="x-grid3-cell-inner x-grid3-col-avgLoss" unselectable="on"&gt;0.79&lt;/div&gt;
                                                                                                      &lt;/td&gt;
                                                                                                      &lt;td id="x-auto-647" class="x-grid3-col x-grid3-cell x-grid3-td-avgJitter " style="width:58px;" role="gridcell"&gt;
                                                                                                          &lt;div class="x-grid3-cell-inner x-grid3-col-avgJitter" unselectable="on"&gt;31&lt;/div&gt;
                                                                                                      &lt;/td&gt;
                                                                                                      &lt;td id="x-auto-648" class="x-grid3-col x-grid3-cell x-grid3-td-avgMOS x-grid3-cell-last " style="width:53px;" role="gridcell"&gt;
                                                                                                          &lt;div class="x-grid3-cell-inner x-grid3-col-avgMOS" unselectable="on"&gt;3.98&lt;/div&gt;
                                                                                                      &lt;/td&gt;
                                                                                                      &lt;/tr&gt;
                                                                                                  &lt;/tbody&gt;
                                                                                              &lt;/table&gt;
                                                                                          &lt;/div&gt;
                                                                                      &lt;/div&gt;                                                                                                          
  </code></pre>