I like to test a complex webapplication written in GWT, and I have some question about how Selenium works.
I have two calendars (monthCalendar1 and monthcalender2). Both have a label with the month and year
I can reach the month and year label in the second calendar with next statement :
WebElement webelement = driver.findElement(By.xpath("//div[contains(@class,'monthCalendar2')]//div[contains(@class,'monthAndYearLabel')]"));
String s = webelement.getText();
//s = December 2018
But I would like to split the website in logical parts, so I want to use :
WebElement webelement = driver.findElement(By.xpath("//div[contains(@class,'monthCalendar2')]"));
WebElement webelement2 = webelement.findElement(By.xpath("//div[contains(@class,'monthAndYearLabel')]"));
webelement2.getText();
String s = webelement2.getText();
//s = November 2018
It looks like webelement2 starts searching from the start of the website, and not from webelement. Can I use the second approach? How?
Kind regards Wim