The page I am trying to test has a span element that is actually functioning as a drop down select menu. The Selenium code for "select" elements does not work and throws the following:
Exception in thread "main" org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "span"
The code for that element looks as the following:
<span style="width: 100%" val="30" id="countVal">30</span>
The code when I open the drop down menu is:
<tr onclick="selectNewCount(1);" class="selec_option">
<td onmouseout="blankit(this)" onmouseover="colorit(this)" class="bones_pointer out_color" id="tdgroup1">50</td>
</tr>
This is how this looks like:
EDIT 1:
This is my Selenium code:
// choose number of records.
try {
WebDriverWait wait = new WebDriverWait(driver, /*seconds=*/10);
element = wait.until(presenceOfElementLocated(By.id("countVal")));
Select select = new Select(element);
select.deselectAll();
select.selectByVisibleText("100");
} catch (NoSuchElementException ex) {
System.out.println("PAGE SOURCE: \n" + driver.getPageSource());
ex.printStackTrace();
}
This is how page source code looks around this element:
I can add more details if required. Thanks.