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 28, 2020 in Selenium by anonymous
• 130 points
5,151 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, 2020 by Sri
• 3,190 points

Related Questions In Selenium

+1 vote
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,500 points
7,912 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
• 28,140 points
1,655 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
932 views
0 votes
1 answer
0 votes
1 answer
0 votes
2 answers

How to scroll the Page up or down in Selenium WebDriver? (using java)

JavascriptExecutor jsx = (JavascriptExecutor)driver; jsx.executeScript("window.scrollBy(0,555)", ""); or Action classes ...READ MORE

answered Sep 6, 2020 in Selenium by Sri
• 3,190 points
18,431 views
0 votes
5 answers

How to scroll down a webpage in selenium using Java?

 to scroll up or down with Selenium, a JavaScript executor is a ...READ MORE

answered Dec 16, 2020 in Selenium by Roshni
• 10,520 points
43,900 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP