Created
October 1, 2013 06:46
send keys to ExtJS combobox, textbox, datefield, ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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