selenium-webdriverxpathwebdriverinternet-explorer-9

Error - First chance exception occured in webdriver.dll


I have a selenium project setup in visual studio 2010 and while debugging , I am getting first chance exceptions in webdriver.dll with additional information:

unable to find xpath == .//[@id='menuForm:projectMenu_span']

As the error says clearly,it was unable to locate the element with xpath. I used firebug to get the xpath. tried using id, css selectors, linktext and none of them are working. I am using internet explorer 9. It worked for the first few times and later on started getting this exception. Code:

Dim wait as WebdriverWait = New WebDriverWait(driver, Timespan.FromSeconds(10))
Dim projMenu as IWebElement = wait.until(ExpectedConditions.ElementVisible(By.XPATH(".//[@id='menuForm:projectMenu_span']")))**

Is there another way to handle this?


Solution

  • try this:

    //div[contains(@id, 'menuForm')]