Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
188 views
by Contributing Tester (78 points)
When i try to select the dropdown using 'Select', following error message is shown.

Element should have been "select" but was "span"

1 Answer

0 like 0 dislike
by The go-to Tester (142 points)
So, as error message says. The element you have selected is SPAN. But, when you use Select class, it expects your element to be Select.

Observe your element and figure out what is the tagname of your element.

There are three possibilities I see here,

1. You might have chosen wrong element identification method. The method may be returning multiple elements and an element with span may be the first one.

2. When you are trying to select your dropdown, someother element is overriding it, and you are selecting it by mistake.

3. Dropdown looks like dorpdown, but it may be not. I mean, it can be a dropdown generated using JavaScript. So, it will look the same, but will behave different. In that case you can try using SendKeys, instead of Select class.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...