The application we are using changes id’s dynamically. I’m trying to do an it on the contents of an readonly input button but can’t seem to get the text.
WebDriver driver = DriverFactory.getWebDriver()
WebElement tableOpenSessions = driver.findElement(By.xpath('//div[@id=\'s-site-body\']/article/div/div[2]/div/div/div/section/div/div/div[2]/div/div/section/div/div/div/div/article/div[2]/div/div/div/div[2]/table'))
WebElement tableOpenSessionsDetails = driver.findElement(By.xpath('//div[@id=\'s-site-body\']/article/div/div[2]/div/div/div/section/div/div/div[2]/div/div/section/div/div/div/div/article/div[2]/div/div/div[2]/div[2]/table'))
WebElement tableActiveProcesses = driver.findElement(By.xpath('//div[@id=\'s-site-body\']/article/div/div[2]/div/div/div/section/div/div/div[3]/div/div/div/div/section/div/div/div/div/article/div[2]/div/div/div/div[2]/table'))
List<WebElement> rowsOpenSessions = tableOpenSessions.findElements(By.tagName('tr'))
List<WebElement> rowsOpenSessionsDetails = tableOpenSessionsDetails.findElements(By.tagName('tr'))
for (int i = 0; i < rowsOpenSessions.size(); i++) {
List<WebElement> colsOpenSessions = rowsOpenSessions.get(i).findElements(By.tagName('td'))
List<WebElement> colsOpenSessionsDetails = rowsOpenSessionsDetails.get(i).findElements(By.tagName('td'))
if (colsOpenSessions.size() > 0) {
colsOpenSessions.get(0).click()
if (colsOpenSessionsDetails.size() > 3) {
WebElement folderNameInput = colsOpenSessionsDetails.get(2).findElement(By.tagName("input"))
String a = folderNameInput.getText()
WebUI.comment(a)
WebElement folderNameInput2 = colsOpenSessionsDetails.get(2).findElement(By.xpath("//input"))
String b = folderNameInput2.getText()
WebUI.comment(b)
}
}
WebUI.delay(2)
}
Both a and b are empty.
<td class="s-grid-cell-edit s-inplace"><div class="s-grid-cell-value-edit s-inplace-value-edit s-readonly"><input type="text" autocomplete="off" spellcheck="false" autocorrect="off" class="s-inplace-input s-readonly" maxlength="10" id="9-154-input" readonly="readonly" title=""></div></td>
Any help would be appreciated.