在 GWT 和 GXT 网格上使用 HTMLUnitDriver
我们正在尝试使用 Selenium HTMLUnitDriver 访问 GWT 网格和 GXT 网格。这些网格分配有一个 ID,网格中的每一行都是一个 inside 。 因此,我们访问网格元素并将其所有行填充到列表中,如下所示:
// Find the grid element by its id
WebElement grid = driver.findElement(By.name("gwt-grid"));
//Get the rows into a list where each row is a table.
List<WebElement> listRows = grid.findElements(By.tagName("table"));
//Pint the number of rows in the list
System.out.println("Total rows: "+listRows.size());
上面的代码在 Firefox 和 IE 驱动程序上正常工作,并给出正确的行数 (500)。但 HTMLUnitDriver 打印零行数。
我已经为 HTML 单元驱动程序启用了 javascript,如下所示:
HtmlUnitDriver driver = new HtmlUnitDriver();
driver.setJavascriptEnabled(true);
有人遇到过这个问题吗?请帮我解决这个问题。
We are trying to access a GWT gring and a GXT grid using Selenium HTMLUnitDriver. These grids have an ID assigned and each row in the grid is a inside .
So, we are accessing the grid element and populate all its rows in to a list as follows:
// Find the grid element by its id
WebElement grid = driver.findElement(By.name("gwt-grid"));
//Get the rows into a list where each row is a table.
List<WebElement> listRows = grid.findElements(By.tagName("table"));
//Pint the number of rows in the list
System.out.println("Total rows: "+listRows.size());
The above code works properly on Firefox and IE drivers and gives correct row count (500). But HTMLUnitDriver prints ZERO row count.
I've enebled javascript for HTML Unit Driver as follows:
HtmlUnitDriver driver = new HtmlUnitDriver();
driver.setJavascriptEnabled(true);
Has anyone faced this issue? Please help me to resolve this issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论