这是我的代码:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('.chk').live('change', function() {
alert('change event fired');
});
$('a').click(function() {
$('.chk').attr('checked', true);
});
});
</script>
</head>
<body>
<div class="chkHolder">
<input type="checkbox" class="chk" name="a" id="a" />
<input type="checkbox" class="chk" name="b" id="b" />
</div>
<a href="#">check all</a>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
当我点击"全部检查"超链接时,我希望为每个复选框触发更改事件.但是,这种情况并没有发生.
有任何想法吗?
非常感谢!
我正在为遗留应用程序编写测试,其中主文档中有一个iFrame,然后是其中的另一个iFrame.所以层次结构是:
Html Div (id = tileSpace)
iFrame (id = ContentContainer)
iFrame (id = Content)
Elements
Run Code Online (Sandbox Code Playgroud)
这是我的代码(我正在使用C#)
RemoteWebDriver driver = new InternetExplorerDriver();
var tileSpace = driver.FindElement(By.Id("tileSpace"));
var firstIFrame = tileSpace.FindElement(By.Id("ContentContainer"));
var contentIFrame = firstIFrame.FindElement(By.Id("Content"));
Run Code Online (Sandbox Code Playgroud)
问题是,我无法达到第二级iFrame即contentIFrame
有任何想法吗?