Element should have been select but was span

Hi, need help
i try to select from DropDow, but i get the following exception.

element should have been select but was span

thx for help to solve my problem

Right click on the drop-down and choose, “Inspect”. Do this twice and you will get the HTML of the page and the drop-down.
The error message indicates the drop-down “effect” is not done by a select tag, but by a span tag. Because you do not have a select tag, that means you will not be able to use, selectOptionByLabel, selectOptionByValue or selectOptionByIndex.
If you can show the HTML, then we may be able to assist you more. The only thing I can add without the HTML is you may have to use web tables to handle the drop-down.

How to handle Web Tables | Katalon Docs

Edit: An alternative is if you used the Spy to detect the element, then maybe you did not touch the drop-down specific enough. You can try again to see if you get a select tag or a span tag again.

I use ‘WebUI.enhancedClick’ or ‘WebUI.Click’ to select drop-down objects. To find a drop-down object’s ‘XPath’ use the following as @grylion54 suggested: From within Chrome right-click on the drop-down dialog & click ‘Inspect’ (do this twice)
**The HTML drop-down object list will be loaded

  • Expand the drop-down object list
  • Right-click on the option to be selected (for example option 2)
  • Click > Copy Xpath
  • Press Ctrl+F from within the Chrome browser
  • Pess Ctrl+V; the following will display: //*[@id=“combo_facility”]/option[2], press ENTER
  • Pressing ENTER should display the resut in yellow

Precondition for the following test case example:
Download objects exist in the Katalon project (example: downLoadObject1, downLoadObject2 & downLoadObject3).
To create manual Objects:
From within Katalon right-click on ‘Object Repository’

  • Click ‘New’ > ‘Folder’ > ‘00ManObjects’, OK
  • From within Katalon right-click on ‘Object Repository’ > ‘00ManObjects’
  • Click ‘New’ > ‘Test Oject’
  • Set the Name to ‘downLoadObject1’ > OK
  • Click the ‘XPath’ radio button
  • Input //[@id=“combo_facility”]/option[1] and save
    Create two more manual objects:
    downLoadObject2; //
    downLoadObject3; //*[@id=“combo_facility”]/option[3]

The following test case uses Katalon’s ‘CURA Healthcare Service’ test website.
This case will select all three dropdown options from the test website.
Create a new test case name; example: PickDownloadObjects and add the following.

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI


WebUI.enhancedClick(findTestObject('CheckDopDownsTwo/Page_CURA Healthcare Service/a_Make Appointment'))

WebUI.setText(findTestObject('CheckDopDownsTwo/Page_CURA Healthcare Service/input_Username_username'), 'John Doe')

WebUI.setText(findTestObject('Object Repository/CheckDopDownsTwo/Page_CURA Healthcare Service/input_Password_password'), 

WebUI.enhancedClick(findTestObject('CheckDopDownsTwo/Page_CURA Healthcare Service/button_Login'))

//downLoadObject1, downLoadObject2 & downLoadObject3 must exist
'Manual object: XPath= //*[@id="combo_facility"]/option[3]'

'Manual object: XPath= //*[@id="combo_facility"]/option[2]'

'Manual object: XPath= //*[@id="combo_facility"]/option[1]'


Now KS throws an exception saying

“element should have been <SELECT> but was <SPAN>

You need to look at the HTML source of the page. You should look at the HTML source code to find out how the drop down menu is constructed. You can look at the HTML source by Chrome DevTools:

You had better stop using Recorder & Spy tools — these offerings by Katalon Studio hides the HTML source from you and will leave you unaware how the page is marked up. These tools may look friendly to you, but in fact they prevents you from learning what you need to see. As long as you innocently depend on these tools, you will get lost when you encounter a twisted problem like this.