使用 selenium webdriver 在 ext-js 网格中选择一行不适用于 IE
Selecting a row in ext-js grid using selenium webdriver does not work for IE
我有一个场景,我需要 select 使用 selenium webdriver 在 ext-js 应用程序的网格中排一行。基于第 selection 行,一些按钮已启用。
html 片段如下
<div id="ext-element-55" class="x-grid-item-container" style="width: 756px; transform: translate3d(0px, 0px, 0px);" role="presentation">
<table id="tableview-1812-record-288" class="x-grid-item x-grid-item-selected" cellspacing="0" cellpadding="0" style=";width:0" data-recordindex="0" data-recordid="288" data-boundview="tableview-1812" role="presentation">
<tbody>
<tr class=" x-grid-row" role="row" aria-selected="true">
<td class="x-grid-cell x-grid-td x-grid-cell-gridcolumn-1825 x-grid-cell-first x-unselectable" data-columnid="gridcolumn-1825" tabindex="-1" role="gridcell" style="width: 378px;">
<div class="x-grid-cell-inner " style="text-align:1;" unselectable="on">FirstElementToSelect</div>
</td>
<td class="x-grid-cell x-grid-td x-grid-cell-gridcolumn-1826 x-grid-cell-last x-unselectable" data-columnid="gridcolumn-1826" tabindex="-1" role="gridcell" style="width: 378px;">
<div class="x-grid-cell-inner " style="text-align:1;" unselectable="on">
</td>
</tr>
</tbody>
</table>
<table id="tableview-1812-record-289" class="x-grid-item x-grid-item-alt" cellspacing="0" cellpadding="0" style=";width:0" data-recordindex="1" data-recordid="289" data-boundview="tableview-1812" role="presentation">
<tbody>
<tr class=" x-grid-row" role="row" aria-selected="true">
<td class="x-grid-cell x-grid-td x-grid-cell-gridcolumn-1825 x-grid-cell-first x-unselectable" data-columnid="gridcolumn-1825" tabindex="-1" role="gridcell" style="width: 378px;">
<div class="x-grid-cell-inner " style="text-align:1;" unselectable="on">SecondElementToSelect</div>
</td>
<td class="x-grid-cell x-grid-td x-grid-cell-gridcolumn-1826 x-grid-cell-last x-unselectable" data-columnid="gridcolumn-1826" tabindex="-1" role="gridcell" style="width: 378px;">
<div class="x-grid-cell-inner " style="text-align:1;" unselectable="on">
</td>
</tr>
</tbody>
</table>
</div>
WebElement Click(在 div/tr/td/table 上试过 - 所有元素)在 Chrome 和 FF 和 select 行中工作正常,但它在 IE 中没有 select 行.还尝试了操作 类、机器人 API,但这些在 IE 上也不起作用。
有没有办法使用本机事件使其在 IE 中工作(除了使用 javascript 到 select)。请注意,在使用 requiredWindowFocus 时,它确实可以在 IE 中使用,但我不想使用它,因为它有局限性
在同一台机器上并行工作并在远程锁定机器上进行 运行 测试。
硒版本 - 2.53.0
浏览器 - IE11
IE 驱动版本 3.0
请分享更多详细信息,例如 IE 版本、Selenium 版本。
请注意,IE 9、10 和 11 中的 Click 事件已经报告了一些问题。查找更多信息 here。
这个点击问题似乎从 IE 9 开始就一直存在。Check here。
但是,请尝试这些方法。这可能是目前的解决方法。
改变driver capabilities
。
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability("nativeEvents",false);
capabilities.setCapability("ignoreZoomSetting", true);
WebDriver driver = new InternetExplorerDriver(capabilities);
尝试javascript click
。检查此 post.
- 尝试
keys.ENTER
。 Official docs.
driver.findElement("path")).sendKeys(KEYS.ENTER);
希望对您有所帮助。
我有一个场景,我需要 select 使用 selenium webdriver 在 ext-js 应用程序的网格中排一行。基于第 selection 行,一些按钮已启用。 html 片段如下
<div id="ext-element-55" class="x-grid-item-container" style="width: 756px; transform: translate3d(0px, 0px, 0px);" role="presentation">
<table id="tableview-1812-record-288" class="x-grid-item x-grid-item-selected" cellspacing="0" cellpadding="0" style=";width:0" data-recordindex="0" data-recordid="288" data-boundview="tableview-1812" role="presentation">
<tbody>
<tr class=" x-grid-row" role="row" aria-selected="true">
<td class="x-grid-cell x-grid-td x-grid-cell-gridcolumn-1825 x-grid-cell-first x-unselectable" data-columnid="gridcolumn-1825" tabindex="-1" role="gridcell" style="width: 378px;">
<div class="x-grid-cell-inner " style="text-align:1;" unselectable="on">FirstElementToSelect</div>
</td>
<td class="x-grid-cell x-grid-td x-grid-cell-gridcolumn-1826 x-grid-cell-last x-unselectable" data-columnid="gridcolumn-1826" tabindex="-1" role="gridcell" style="width: 378px;">
<div class="x-grid-cell-inner " style="text-align:1;" unselectable="on">
</td>
</tr>
</tbody>
</table>
<table id="tableview-1812-record-289" class="x-grid-item x-grid-item-alt" cellspacing="0" cellpadding="0" style=";width:0" data-recordindex="1" data-recordid="289" data-boundview="tableview-1812" role="presentation">
<tbody>
<tr class=" x-grid-row" role="row" aria-selected="true">
<td class="x-grid-cell x-grid-td x-grid-cell-gridcolumn-1825 x-grid-cell-first x-unselectable" data-columnid="gridcolumn-1825" tabindex="-1" role="gridcell" style="width: 378px;">
<div class="x-grid-cell-inner " style="text-align:1;" unselectable="on">SecondElementToSelect</div>
</td>
<td class="x-grid-cell x-grid-td x-grid-cell-gridcolumn-1826 x-grid-cell-last x-unselectable" data-columnid="gridcolumn-1826" tabindex="-1" role="gridcell" style="width: 378px;">
<div class="x-grid-cell-inner " style="text-align:1;" unselectable="on">
</td>
</tr>
</tbody>
</table>
</div>
WebElement Click(在 div/tr/td/table 上试过 - 所有元素)在 Chrome 和 FF 和 select 行中工作正常,但它在 IE 中没有 select 行.还尝试了操作 类、机器人 API,但这些在 IE 上也不起作用。 有没有办法使用本机事件使其在 IE 中工作(除了使用 javascript 到 select)。请注意,在使用 requiredWindowFocus 时,它确实可以在 IE 中使用,但我不想使用它,因为它有局限性 在同一台机器上并行工作并在远程锁定机器上进行 运行 测试。
硒版本 - 2.53.0 浏览器 - IE11 IE 驱动版本 3.0
请分享更多详细信息,例如 IE 版本、Selenium 版本。
请注意,IE 9、10 和 11 中的 Click 事件已经报告了一些问题。查找更多信息 here。
这个点击问题似乎从 IE 9 开始就一直存在。Check here。
但是,请尝试这些方法。这可能是目前的解决方法。
改变
driver capabilities
。
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer(); capabilities.setCapability("nativeEvents",false); capabilities.setCapability("ignoreZoomSetting", true); WebDriver driver = new InternetExplorerDriver(capabilities);
尝试
javascript click
。检查此 post.- 尝试
keys.ENTER
。 Official docs.
driver.findElement("path")).sendKeys(KEYS.ENTER);
希望对您有所帮助。