在IFRAME量角器测试其他非角应用程序? [英] Protractor testing in iframe in other non-Angular application?

查看:207
本文介绍了在IFRAME量角器测试其他非角应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序集成了其他网站。该积分是通过点击按钮确立。当我点击该按钮,弹出显示了来自其他网站的HTML。我将展示通过把URL的iframe中使用此内容。链接外部网站:

My application is integrated with other site. That integration is established by clicking on the button. When I click on the button, pop-up shows with html that comes from another site. I show that content using this by putting URL in iframe. Url is from external site:

<iframe class='' ng-src="{{url}}"></iframe>

我是可以执行的上弹出元素我量角器测试?

Can I execute my protractor test on elements on that pop-up?

当我试图通过ID来获得元素上弹出,它说的没有这样的元素中。我通过Firefox的Firebug的工具元素的标识。我打这个,它返回我假的:

When I try to access to element on pop-up by ID, it says No such element found. I got IDs of elements by Firebug tool on Firefox. I hit this, and it returns me false:

expect(element(by.id('**id of element in pop-up**')).isDisplayed()).toBe(true);

有人可以帮助我?是否有可能运行量角器测试和这种HTML的?

Can someone help me with this? Is it possible to run Protractor tests and on this kind of html?

推荐答案

您需要将上下文切换到iframe中。您可以通过添加code的这些行做到这一点:

You need to switch context to iframe. You can do that by adding these lines of code:

var driver = ptor.driver;
ptor.switchTo().frame(driver.findElement(protractor.By.tagName('iframe')));

尝试访问您的元素弹出现在呢?

Try to access your elements in pop-up now?

这篇关于在IFRAME量角器测试其他非角应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆