The Stack Overflow podcast is back! Listen to an interview with our new CEO.
4 added 219 characters in body; edited tags; edited title
source | link

org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "div" error

seleniumHTML code - new Select(driver.findElement(By.xpath(//*[contains(@id,'instrChqClgType')])))of the desired element:

<select class="fcr-height-parent oj-select-select oj-component-initnode oj-select-options-generated" data-bind="attr:{id: idTag, name: idTag}, id="40026501instrChqClgType" name="40026501instrChqClgType" aria-required="true" style="border-color: rgb(4, 95, 171);"><option class="oj-listbox-result oj-listbox-result-selectable oj-listbox-results-depth-0" role="option" id="oj-listbox-result-label-14" value=""></option></select></div>

Selenium code:

new Select(driver.findElement(By.xpath(//*[contains(@id,'instrChqClgType')])))

Getting the following error:

org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "div"

What could be the reason?

org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "div"

selenium code - new Select(driver.findElement(By.xpath(//*[contains(@id,'instrChqClgType')])))

Element should have been "select" but was "div" error

HTML code of the desired element:

<select class="fcr-height-parent oj-select-select oj-component-initnode oj-select-options-generated" data-bind="attr:{id: idTag, name: idTag}, id="40026501instrChqClgType" name="40026501instrChqClgType" aria-required="true" style="border-color: rgb(4, 95, 171);"><option class="oj-listbox-result oj-listbox-result-selectable oj-listbox-results-depth-0" role="option" id="oj-listbox-result-label-14" value=""></option></select></div>

Selenium code:

new Select(driver.findElement(By.xpath(//*[contains(@id,'instrChqClgType')])))

Getting the following error:

org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "div"

What could be the reason?

3 deleted 1850 characters in body
source | link

selenium code - new Select(driver.findElement(By.xpath(//*[contains(@id,'instrChqClgType')])));

renderMode:renderModeValue, required :isRequired , disabled :keyField , options: selectOptions, rootAttributes:attributes , optionChange:onChange, value: dataPath},event : {blur : blankValidation,focus : onFocus}" id="40026501instrChqClgType" name="40026501instrChqClgType" aria-required="true" style="border-color: rgb(4, 95, 171);">1-MICR CLEARING FLOAT 14-INTERBANK CLG FLOAT 015-HIGH VALUIE CLEARING32-MICR - 18 FLOAT 277-Regular Clearing78-Float 2

selenium code - new Select(driver.findElement(By.xpath(//*[contains(@id,'instrChqClgType')])));

renderMode:renderModeValue, required :isRequired , disabled :keyField , options: selectOptions, rootAttributes:attributes , optionChange:onChange, value: dataPath},event : {blur : blankValidation,focus : onFocus}" id="40026501instrChqClgType" name="40026501instrChqClgType" aria-required="true" style="border-color: rgb(4, 95, 171);">1-MICR CLEARING FLOAT 14-INTERBANK CLG FLOAT 015-HIGH VALUIE CLEARING32-MICR - 18 FLOAT 277-Regular Clearing78-Float 2

selenium code - new Select(driver.findElement(By.xpath(//*[contains(@id,'instrChqClgType')])))

2 added 1854 characters in body
source | link

selenium code - new Select(driver.findElement(By.xpath(//*[contains(@id,'instrChqClgType')])));

renderMode:renderModeValue, required :isRequired , disabled :keyField , options: selectOptions, rootAttributes:attributes , optionChange:onChange, value: dataPath},event : {blur : blankValidation,focus : onFocus}" id="40026501instrChqClgType" name="40026501instrChqClgType" aria-required="true" style="border-color: rgb(4, 95, 171);">1-MICR CLEARING FLOAT 14-INTERBANK CLG FLOAT 015-HIGH VALUIE CLEARING32-MICR - 18 FLOAT 277-Regular Clearing78-Float 2

code - new Select(driver.findElement(By.xpath(//*[contains(@id,'instrChqClgType')])));

selenium code - new Select(driver.findElement(By.xpath(//*[contains(@id,'instrChqClgType')])));

renderMode:renderModeValue, required :isRequired , disabled :keyField , options: selectOptions, rootAttributes:attributes , optionChange:onChange, value: dataPath},event : {blur : blankValidation,focus : onFocus}" id="40026501instrChqClgType" name="40026501instrChqClgType" aria-required="true" style="border-color: rgb(4, 95, 171);">1-MICR CLEARING FLOAT 14-INTERBANK CLG FLOAT 015-HIGH VALUIE CLEARING32-MICR - 18 FLOAT 277-Regular Clearing78-Float 2

1
source | link