This is a issue I did not expect to run into. I am writing a selenium Webdriver test using JUnit 4 in eclipse on Ubuntu 11. I had been using Selenium IDE combined with firebug and firepath to make sure that the xpaths I was specifying in my JUnit test were correct. What I've run into is a problem where the selenium IDE command,
command 'click' at target '//span[contains(text(),'MyTarget')]/PATHTOTARGET'
passes every time. However when I use the following in webdriver it always fails
driver.findElement(By.xpath("//span[contains(text(),'MyTarget')]/PATHTOTARGET")).click();
I have been using Selenium IDE and Selenium Webdriver for a couple months now so have written my share of click commands and never run into this. Anyone have an idea what could be causing this?
The xpath is NOT changing upon refresh it is valid each time. I have also tried waiting for everything on the page to load without luck.
edit1: This was an issue caused by the way our application's extJS context menus worked. If you selected one item from the context menu our application would do some work that caused the context menu to go out of selenium's focus. Adding a refresh followed by an extended wait before selecting a new menu item worked the best.
WebDriverif you're stuck. - biziclopWebDriver.getPageSource(), should work withFirefoxDriver- biziclopNoSuchElementExceptionor something other? - Petr Janeček