Currently there are couple links that suppose to help with this task: general (1) and specific (2) approached.
However (1) does not contain any code to start with and (2) contains only js one-liner.
My question is how to get values from extjs-generated row cells?
For example, I've row element
div#ext-gen-list-057-r.x-grid3-row.grid-rowcolor-black.grid-fontweight-normal.grid-fontstyle-normal.recordListRow.TableEvenRow.x-grid3-row-first.x-grid3-row-focus
where cells are represented like
td.x-grid3-col.x-grid3-cell.x-grid3-td-0.x-grid3-cell-first
How do I get it's values using python and selenium webdriver?
UPD
After some search there are few details revealed:
browser.find_element(By.ID, 'element-id')
will simply not work for ExtJS webpage as soon as document.getElementById('element-id')
is null
(correct me if it's wrong) Ext.getBody('body-element-id')
However, there is no such method for Select
in selenium.webdriver.support.ui
that will allow to access body elements.
Thus, the issue has not yet been resolved.
May be this sample java code can help you. It doesn't directly answer your question, but you can easily convert it to python and also get an insight into solving your problem.
This code gets the extjs grid from the page, iterates through its rows to check if there is any cell containing the example id(1010294), then get the corresponding row and click the 8th cell on that row. 8th cell contains a button to click.
WebElement editCustTable = driver.findElement(By.className("x-grid-table"));
List<WebElement> tableRows = editCustTable.findElements(By.tagName("tr"));
for (Iterator iterator = tableRows.iterator(); iterator.hasNext();) {
WebElement row = (WebElement) iterator.next();
// if tr contains id = '1010294'
if(row.getAttribute("id").contains("1010294")){
List<WebElement> tds = row.findElements(By.tagName("td"));
tds.get(8).click();
break;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.