【发布时间】:2012-12-19 18:33:45
【问题描述】:
我正在 Ubuntu 上使用 Watir-WebDriver 和 Ruby 1.9.2 为 web 编写自动测试。我有一些包含几个元素的 iframe。我需要单击这些项目并检查会发生什么。 <iframe> 看起来像:
<iframe id="iframe" align="top" some_attribute="some_attribute">
<html>
<head>
<title> Some title </title>
</head>
<body>
<div>
<button id="id_button" type="button" class="some_class"/>
</div>
</body>
</html>
</iframe>
当我点击按钮时,它应该创建菜单。但是当我点击带有 watir-webdriver 的按钮时,什么也没有发生,好像他没有按下一样。 Watir 不打印任何异常,但不要按下按钮。
此问题仅在 Internet Explorer 中仍然存在。对于 Firefox 和 Chrome,没有问题。我的代码如下:
browser = Watir :: Browser.new (: remote,: url => "http://some_ip:4444/wd/hub",: desired_capabilities =>: internet_explorer)
browser.goto ("http://some_http.com")
browser.iframe.button (: id, "id_button"). click
如果我写
browser.iframe.button(: id, "id_button").attribute_value("class")
它正在返回"some_class"。这表明该项目已被识别,但仍然没有任何反应。
【问题讨论】:
标签: html ruby watir-webdriver selenium-webdriver