What coding practices do I use in Vaadin to ensure I can record Selenium scripts? What coding practices do I use in Vaadin to ensure I can record Selenium scripts? selenium selenium

What coding practices do I use in Vaadin to ensure I can record Selenium scripts?


If you use Vaadin use setDebugId(String id) method. All visual components has this method. After that you simply select element by ID.
WebDriver it look like:

WebElement el = webDriver.findElement(By.id("yourElementId"));el.sendKeys("123");


Selenium 1.0

 selenium.type("id=yourElementId", "123");

But sometime you will need more complex selector. In our project we use XPath with element id.
WebDriver it look like:

WebElement el = webDriver.findElement(By.xpath("//div[@id='yourElementId']/div"));el.sendKeys("123");


Selenium 1.0

 selenium.type("//div[@id='yourElementId']/div", "123");


The best way would be to get pro user accounts for your team and use the vaadin testbench. You can then profit from the experiences made by senior vaadin developers and save a lot of effort.