我正在尝试从Chrome浏览器的下拉列表中选择值,但它总是给我错误:
Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"id","selector":"select2-ddlConcern-result-dvsy-23"}
(Session info: chrome=64.0.3282.186)
以下是我的代码。问题在最后一行。任何人都可以帮助我吗?
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "D:\\eclipse\\ChromeDriver\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://192.165.0.12/knowmax4_idea_new");
driver.manage().window().maximize();
WebElement email = driver.findElement(By.id("txtLoginId"));
email.sendKeys("xxx");
WebElement password = driver.findElement(By.id("txtPassword"));
password.sendKeys("xxxxxxx");
WebElement submit = driver.findElement(By.id("btnLogin"));
submit.click();
Thread.sleep(12000);
WebElement MobileNumber = driver.findElement(By.id("txtMobileNo"));
MobileNumber.sendKeys("9855958911");
WebElement customer = driver.findElement(By.xpath("//*/div[2]/div[1]/div[1]/div[2]/div[2]/div[2]/input"));
customer.sendKeys("Manpreet Singh");
WebElement issue = driver.findElement(By.xpath("//*/div[2]/div[1]/div[1]/div[2]/div[2]/div[3]/span/span[1]/span/span[2]"));
issue.click();
//WebElement issue = driver.findElement(By.id(""));
//Select dropdown = new Select(driver.findElement(By.className("select2-selection__arrow")));
//((WebElement) dropdown).click();
WebElement iselection = driver.findElement(By.id("select2-ddlConcern-result-dvsy-23"));
iselection.click();