Skip to content

Instantly share code, notes, and snippets.

@huguogang
Created October 1, 2013 06:46
send keys to ExtJS combobox, textbox, datefield, ...
//find the fully qualified component query of ExtJS component cmp
String query = cmp.componentQuery;
Component parent = cmp.parent;
while (parent != null) {
query = parent.componentQuery + " " + query;
parent = parent.parent;
}
//use component query to find id of inputEl
//the only change here is the addition of inputEl before .id
String js = "return Ext.ComponentQuery.query(\"" + query + "\")[0].inputEl.id;";
String id = (String) ((JavascriptExecutor) _driver).executeScript(js);
WebElement element = driver.findElement(By.id(id));
//Now, this web element accepts sendKeys
element.sendKeys("it works");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment