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

46 views
Skip to first unread message

Muhammad Yaqoob

unread,
Jun 24, 2022, 3:03:27 AM6/24/22
to Selenium Users
Exception in thread "main" org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "input"


Plz help me to this probem
error.PNG
error2.PNG

Nortier David

unread,
Jun 24, 2022, 4:16:22 AM6/24/22
to seleniu...@googlegroups.com

Hello

 

Ant-design is very strange, boring, …

Ant-design creates div & div & div & div … and creates its own classnames

 

Select doesn’t exist with ant-design (new Select doesn’t work)

 

You have an input, designation for you

You must click in the “input” (parent : div)

The list of options appears : it’s a div à id : InputName_list (for you designation_list)

 

Ex in c#:

(idSelect = designation)

 

IWebElement select = this.FindElement(How.XPath, "//*[@id='" + idSelect + "']/parent::span/parent::div");

this.ClickOnElement(select, scroll: true);

 

IWebElement options = this.FindElement(How.XPath, "//*[@id='" + idSelect + "_list']//parent::div");

ReadOnlyCollection<IWebElement> list = options.FindElements(By.XPath(".//div[contains(@class, 'ant-select-item ant-select-item-option')]"));

 

               Then, with foreach, you’ll find what your search

 

 

David

 

De : seleniu...@googlegroups.com <seleniu...@googlegroups.com> De la part de Muhammad Yaqoob
Envoyé : dimanche 19 juin 2022 08:41
À : Selenium Users <seleniu...@googlegroups.com>
Objet : [selenium-users] Element should have been "select" but was "input"

 

Exception in thread "main" org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "input"

 

 

Plz help me to this probem

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/7ffca4d8-d7b7-471d-a730-e8ba4b25b06en%40googlegroups.com.


====== DISCLAIMER ======

https://www.cph.be/maildisclaimer

Reply all
Reply to author
Forward
0 new messages