OpenQA.Selenium.NoSuchElementException:无法找到带id的元素

时间:2013-12-02 07:33:22

标签: c# webdriver selenium-webdriver

webdriver代码无法在C#中使用

Driver.FindElement(By.LinkText("portletComponentWorkList_viewNormalModeWorkList_viewPanel_showFiltersLink")).Click();

我试过

Driver.FindElement(By.id

但它不起作用,我在visualstudio中遇到错误 错误讯息:

OpenQA.Selenium.NoSuchElementException : Unable to find element with id == portletComponentWorkList_viewNormalModeWorkList_viewPanel_showFiltersLink

错误堆栈跟踪:

OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute,  Dictionary`2 parameters)
OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value)
OpenQA.Selenium.Remote.RemoteWebDriver.FindElementById(String id)
OpenQA.Selenium.By.<>c__DisplayClass2.<Id>b__0(ISearchContext context)
OpenQA.Selenium.By.FindElement(ISearchContext context)
OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(By by)
SeleniumTests.ReviewCase.TheReviewCaseTest() in C:\Automation\CSharp\SpecExperiment\SpecExperiment\UnitTest2.cs: line 46

1 个答案:

答案 0 :(得分:0)

尝试Driver.FindElement(By.LinkText("Show filters")).Click();