【发布时间】:2018-04-14 13:07:08
【问题描述】:
*** 用相关的 html 代码更新了问题。
错误是
线程“主”org.openqa.selenium.NoSuchElementException 中的异常:无法使用 css 选择器 == #oHeight 找到元素
Selenium Docs中提到的所有IE设置我已经设置好了
我尝试过的代码如下:
System.setProperty("webdriver.ie.driver", "D:\\Workspace\\Selenium\\Model\\servers\\IEDriverServer_32bit.exe");
WebDriver driver = new InternetExplorerDriver();
driver.manage().timeouts().implicitlyWait(15000, TimeUnit.MILLISECONDS);
driver.get("http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/showModalDialog2.htm");
WebElement ddlHeight = driver.findElement(By.id("oHeight"));
Select select = new Select(ddlHeight);
select.selectByVisibleText("150");
driver.findElement(By.xpath("//input[@value='Push To Create']")).click();
driver.quit();
系统配置为 Windows 7 + IE 11
【问题讨论】:
-
用相关的HTML更新问题
-
@DebanjanB 已更新,请检查并让我知道以寻求帮助。
-
为什么选择元素使用
name而不是id? -
@RatmirAsanov 我很糟糕,我已将其更改为 id 但仍然出现相同的错误。
-
@SandeepRaulo,你在哪一行代码之后出现了这个错误?
标签: selenium internet-explorer selenium-webdriver nosuchelementexception