我正在用量角器编写e2e测试,需要访问Angular 2应用程序中的iframe元素。量角器iframe元素未找到/不可见
我相信我已经成功切换到iframe,但由于某种原因,我希望选择的元素在我的测试中抛出一个错误:“没有找到与CSS ID选择器....”或“元素是不可见。”
这里是我的代码:
this.fillOutInfo = function(input){
this.selectBox.click().then(function(){
browser.switchTo().frame(this.selectBox)
.then(function(){
browser.findeElement(by.id('recurly-hosted-input-field')).sendKeys(input)
.then(function(){
browser.switchTo().defaultContent();
})
})
})
} //selectBox references the iframe element within the DOM
的ID上面是明显存在的代码时,我检查元素,但由于某种原因它不被访问。我的功能是否执行不正确?我已经尝试了不同的方法来查找我需要的输入,例如嵌套定位器,但没有任何工作。
任何帮助非常感谢!
在嵌套的'then'中有你的console.log吗?如何解决量角器中的承诺? –
你已经提到了'browser.findeElement'。这是一个错字吗? –
@SudharsanSelvaraj是的,对不起,这是在stackoverflow错字,而不是在实际的代码 –