In this case, I cannot select a day before the actual day.
I am having a lot of trouble trying to double click in one of the days of the agenda.
This is what I was trying to do:
WebDriver driver = DriverFactory.getWebDriver()
WebElement Table = driver.findElement(By.className('k-scheduler-content'))
List<WebElement> Rows = Table.findElements(By.tagName('tr'))
println('Rows: ' + Rows.size())
println('Rows: ' + Rows.get(0).getText())
//List<WebElement> tr_withImg = Table.findElements(By.xpath('//tr[*//img[contains(@id, \'vMODIFICAR_\')]]'))
Date today = new Date()
String todaysDate = today.format('mm/dd/yy').substring(3, 5)
for (int i = 0; i < Rows.size(); i++) {
List<WebElement> Cols = Rows.get(i).findElements(By.tagName('td'))
for (int j = 0; j < Cols.size(); j++) {
if (Cols.get(j).getText().equals(todaysDate)) {
println(Cols.get(j).getText())
print(i + " " + j + " ")
TestObject toV = new TestObject()
String objectXpathV = CustomKeywords.'keywordPrueba.CustomFunction.createIdRelative'('////div[@id=\'schedulerSch\']/table/tbody/tr[2]/td/div/table/tbody/tr[', i,j)
toV.addProperty('xpath', ConditionType.EQUALS, objectXpathV)
WebUI.waitForElementPresent(toV, 30)
WebUI.delay(3)
WebUI.doubleClick(toV)
}
}
}
Here I try to iterate through the agenda table. Find the “cell” with the actual day and double click.
As I was having a lot of trouble trying to accomplish this, I create a new Test object and add its Id.
This is how I do it:
But this wont work as it never finds that object with that id:
Unable to find the element located by ‘By.xpath: ////div[@id=‘schedulerSch’]/table/tbody/tr[2]/td/div/table/tbody/tr[2]/td[2]’. Please recheck the objects properties to make sure the desired element is located.
Thanks once again for the response.
When I do that in the console it does not work. The thing is that I need to double click if not I would do something like Cols.get(j).click
Solved !
This line was wrong:
String objectXpathV = CustomKeywords.‘keywordPrueba.CustomFunction.createIdRelative’(’////div[@id=‘schedulerSch’]/table/tbody/tr[2]/td/div/table/tbody/tr[’, i,j)
It should be like this:
CustomKeywords.‘keywordPrueba.CustomFunction.createIdRelative’(’//div[@id=‘schedulerSch’]/table/tbody/tr[2]/td/div/table/tbody/tr[’, i,j)
Thanks a lot for the answer.
My solution or yours do not work, because in a certain point the page refreshes and it stops me from clicking no matter what method I use.
Why it does it? I do not know because this was not happening yesterday
Its a strange thing because I sometimes notice the page refreshes and sometimes I do not. In any of this cases, I cannot click. I will keep on searching what the problem is and let you know if I can solve it.