0

I am using Selenium Java WebDriver to automate a Vaadin based web application. When I navigate to a page and click a button it opens up another small window which does not look like a popup to me. It seems the subwindow is dynamically added to the main html.

Does anyone have any idea on how to identify Vaadin elements in Selenium?

Saikat
  • 14,222
  • 20
  • 104
  • 125

2 Answers2

1

try with

driver.findElement(By.className("v-window")) for the entire window or driver.findElement(By.className("v-window-contents")) for the window content.

Jose Luis Martin
  • 10,459
  • 1
  • 37
  • 38
  • it is v-window-contents. But no luck using that as well- org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"class name","selector":"v-window-contents"} – Saikat Aug 11 '14 at 06:08
0

When you creating test be sure to run this test after the browser is open. Sometimes test starts, but browser is not open. I put Thread.sleep(1000); in @Before class, to be sure chrome is open.

@Before
public void openBrowser() throws InterruptedException {
    System.setProperty("webdriver.chrome.driver", "chromedriver");
    driver = new ChromeDriver();
    driver.get("http://localhost:8000");
    Thread.sleep(1000);
}

and then

@Test
public void testLoginFormExists() {
    WebElement login = driver.findElement(By.id("username"));
    WebElement password = driver.findElement(By.id("password"));
    ...
}

or even better, check this answer: https://stackoverflow.com/a/9430377/1168786

Community
  • 1
  • 1
ssuperczynski
  • 3,190
  • 3
  • 44
  • 61