尝试使用IE11中的selenium webdriver登录时出错

时间:2015-12-01 16:19:54

标签: selenium-webdriver

当我尝试登录并在IE11中使用selenium webdriver选择登录页面中的下拉列表时,我收到以下错误。

[{
DesiredCapabilities capabilities=DesiredCapabilities.internetExplorer();
        capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
        System.setProperty("webdriver.ie.driver", "C://Users//chetana.inamdar//Desktop//selenium//IEDriverServer.exe");
        WebDriver driver = new InternetExplorerDriver(capabilities);
        driver.navigate().to("url");

        driver.findElement(By.id("ctl00_plhContent_txtUserName")).sendKeys("username");
        driver.findElement(By.id("ctl00_plhContent_txtPassword")).sendKeys("Password");
        driver.findElement(By.id("ctl00_plhContent_btnLogin")).click();

        driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);



        //Select dropdown=new Select(driver.findElement(By.xpath(".//*[@name='ctl00$plhContent$Tabs$pnltabPermanentArea$ddlIDSearch']")));
        Select dropdown=new Select(driver.findElement(By.name("ctl00$plhContent$Tabs$pnltabPermanentArea$ddlIDSearch")));
            dropdown.selectByValue("CS Number");
         System.out.println("the output of selected is"+driver.findElement(By.id("ctl00_plhContent_Tabs_pnltabPermanentArea_ddlIDSearch")).isSelected());

         driver.findElement(By.id("ctl00_plhContent_Tabs_pnltabPermanentArea_txtIDSearch")).sendKeys("1234");
}]

错误:

Screenshot

0 个答案:

没有答案