I am getting error Element should have been select but was input using Selenium Webdriver Java

0 votes

When I select the value form dropdown box it is throwing Error message "Element should have been "select" but was "input” is shown when I select the value form drop down box. I have tried with selectByValue() and selectByIndex().

Below is my HTML:

<div class="rcbScroll rcbWidth" style="width: 100%; overflow: auto; height: 40px;">

<ul class="rcbList" style="list-style:none;margin:0;padding:0;zoom:1;">

<li class="rcbItem">TIN</li>

<li class="rcbHovered">SSN</li>



And the java code:

Select select=new Select(driver.findElement(By.xpath(OR.getProperty("SSN"))));

Jun 27, 2018 in Selenium by Martin
• 4,330 points

how to solve the same in python .i tried 

driver.find_element_by_xpath("//*[text()='Full SCan']/li").click()


driver.find_element_by_xpath("//*li[text()='Full Scan']").click()

both aren't working

Hi Riya, instead of using xpath, use className to identify the dropdown item. Following command would help you:


Hi @riya, try this:

driver.find_element_by_xpath("//li[@name='element_name']/option[text()='Full Scan']").click()

Either use element name or use option with text. Don't use both at once as shown in the above code. 

1 answer to this question.

0 votes

You can Select element by the following method:


 and next select the desired drop down in following way :

driver.findElement(By.xpath("//li[text() = 'SSN']")).click();
answered Jun 27, 2018 by Samarpit
• 5,890 points

Related Questions In Selenium

0 votes
1 answer

I am getting Stale element exception when I try to automate angular js - drop down using Selenium with Java

Hey @Dhivya, StaleElementReferenceException is thrown when an ...READ MORE

answered Feb 12, 2020 in Selenium by Sirajul
• 59,110 points
+1 vote
2 answers
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
0 votes
1 answer

Firefox browser not opening with given URL using Selenium Webdriver with Java

Download the latest selenium jar and replace ...READ MORE

answered Apr 30, 2018 in Selenium by Samarpit
• 5,890 points
0 votes
1 answer

How to get next sibling element using XPath and Selenium for Java?

Below code will help you: Try following-sibling axis : WebElement ...READ MORE

answered May 15, 2018 in Selenium by Samarpit
• 5,890 points