In order to edit the content of a cell you need to double click on it. However with webdriver they don't have a doubleclick function in the api. How else can I change the content of the cell?
+1
A:
What grid are you asking about? For most grids there's a JavaScript function to start editing a cell.
Anyway you can fire a double click with a JavaScript. Assuming the the element
is a IWebElement
on which you would like to double click:
For the InternetExplorerDriver
:
((IJavascriptExecutor)driver).ExecuteScript(
"arguments[0].fireEvent('ondblclick')", element);
For the FirefoxDriver
and 'ChromeDriver':
((IJavascriptExecutor) driver).ExecuteScript(
"var evt = document.createEvent('MouseEvents'); evt.initMouseEvent('dblclick'," +
"true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0," +
"null); " +
"arguments[0].dispatchEvent(evt);", element);
ZloiAdun
2010-07-28 10:32:51
The grid's class is "x-grid3"
Reflux
2010-07-28 17:21:08
If it is an ExtJS Grid, then it has a method startEditing( Number rowIndex, Number colIndex ) which can be fired
ZloiAdun
2010-07-29 12:44:34