How to handle drop down having SPAN Tags. Please help me.

+1 vote
Hi Team,

I have to handle dropdown contains span tags. I have written the code for input & select tags but it's not working.

I am reading the status (Reject) from excel and trying to choose the same value in a dropdown. but it's not selecting.

Please help.

Regards,

Basha.
May 27 in Selenium by anonymous
• 130 points
125 views
Hey, could you please post the code snippet that you have used and also the error that you are getting?

1 answer to this question.

+1 vote

Hi can u try this once.

Select select = new Select(driver.findElement(By.xpath("//path_to_drop_down")));
select.deselectAll();
select.selectByVisibleText("Value1");
or 
List<WebElement> webElements1 = driver.findElements(By.id("id"));

for(WebElement webElement1 : webElements1) {             

 if( webElement1.getAttribute("name").equals("UrText"))

 {           
    WebElement web1 = webElement1.findElement(By.className("selectboxit-text"));

     JavascriptExecutor js = (JavascriptExecutor)driver;
    js.executeScript("arguments[0].click();", web1);       
 }
}
answered Jun 3 by Sri
• 220 points

Related Questions In Selenium

0 votes
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,510 points
3,747 views
0 votes
2 answers

Can anyone help me that how to run Selenium WebDriver test cases in Chrome?

You first need to download chrome driver ...READ MORE

answered Aug 26, 2019 in Selenium by Abha
• 27,910 points
613 views
0 votes
1 answer

How to choose from a drop-down in Selenium 2?

You can probably use the 'Select' class ...READ MORE

answered Apr 24, 2018 in Selenium by king_kenny
• 3,710 points
289 views
0 votes
1 answer
0 votes
1 answer
+1 vote
2 answers

how to display all items in the list in the drop down?

Try using following code:  WebElement dropdown = ...READ MORE

answered Sep 30, 2019 in Selenium by Anvi
• 14,050 points
1,026 views
0 votes
1 answer

Please tell me how to do Automation script using Spring boot in Intelliji Idea

@Ansuri, can you please be more specific ...READ MORE

answered Nov 4, 2019 in Selenium by Abha
• 27,910 points
191 views