This is My HTML:
<tbody>
<tr>
<td colspan="2" style="text-align:center;font-weight:bold;padding-bottom:10px;">You have Statewide Access<br>Please select the district in which you want to operate</td>
</tr>
<tr>
<td style="text-align:right;width:50%;font-weight:bold;padding-right:10px;"><label for="districtOption">Select District</label></td>
<td style="text-align:left;width:50%;">
<select id=`district Option` name="district Option" size="0" alt="Select District" tab index="1">
<option value="00" selected="">-- SELECT --</option>
<option value="01"> A1 </option>
<option value="02"> A2 </option>
</select>
</td>
</tr>
My First Try:
Select select = new Select(driver.findElement(By.xpath("//select[@id='distrctOption']")));
select.selectByVisibleText("A1");
Second Try:
Select dropdown = new Select(driver.findElement(By.id("districtOption")));
dropdown.selectByIndex(01);
driver.findElement(By.xpath("//[@value='Select']")).click();
Error Message in Console for every executing one Error "Exception in thread "main"
org.openqa.selenium.NoSuchElementException Unable to locate element"
*** Element info: {Using=xpath, value=//select[@id='districtOption']}
I tried all possible ways i can ?
There are no Frames in Page, but still not able to Select it.