package Practice;

import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.;
import org.testng.annotations.Test;

public class Vistair2 {
@Test
public void seeProducts() throws InterruptedException{

System.setProperty("webdriver.chrome.driver", "/Users/dominiclee/Documents/workspace/chromedriver 4");
WebDriver driver = new ChromeDriver();
driver.get("https://www.vistair.com/");
driver.manage().window().maximize();

Thread.sleep(10000);
//Create action builder instance by passing WebDriver instance
driver.findElement(By.id("hs-eu-confirmation-button")).click();
Actions builder = new Actions(driver);
WebElement menuElement = driver.findElement(By.linkText("SOLUTIONS"));
builder.moveToElement(menuElement).build().perform();
Thread.sleep(10000);

Select dropDown = new Select (driver.findElement(By.linkText("SOLUTIONS")));
List<WebElement> e = dropDown.getOptions();
int itemsCount = e.size();
System.out.println(itemsCount);
//driver.close();

}

}

When I run this in Selenium I get the following error: should have been “select” but was “a”

I want to find the size of the dropdown menu?



Source link https://sqa.stackexchange.com/questions/35467/org-openqa-selenium-support-ui-unexpectedtagnameexception-element-should-have-b

LEAVE A REPLY

Please enter your comment!
Please enter your name here