1

In the HTML below, there is a div tab that contains an li list which appears as a drop down. I want to select a value from this list using an xpath locator.

Html code.

<div id="boundlist-1277-listWrap" data-ref="listWrap" role="presentation" class="x-boundlist-list-ct x-unselectable x-no-touch-scroll x-scroll-container" style="overflow: auto; height: 298px;">
  <ul id="boundlist-1277-listEl" data-ref="listEl" class="x-list-plain x-scroll-scroller">
    <li role="option" unselectable="on" class="x-boundlist-item x-boundlist-item-over" tabindex="-1" data-recordindex="0" data-recordid="20478" data-boundview="boundlist-1277">Assessment Completion - Returned To Functional Validation</li>
    <li role="option" unselectable="on" class="x-boundlist-item" tabindex="-1" data-recordindex="1" data-recordid="20479" data-boundview="boundlist-1277">Assessment Completion - Workflow Ended</li>
  </ul>
</div>

Can anyone help me on this issue?

1 Answer 1

1

Try this way.

Explanation: Use Relative xpath method, your dropdown selection value is inside the Ul tag. so start your xpath with ul tag and then move ahead with li tag along with text method.

Click on this Assessment Completion - Workflow Ended

driver.findElement(By.xpath("//ul/li[contains(text(), 'Assessment Completion - Workflow Ended')]")).click();

OR

Click on this Assessment Completion - Returned To Functional Validation

driver.findElement(By.xpath("//ul/li[contains(text(), 'Assessment Completion - Returned To Functional Validation')]")).click();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.