硒没有看到AngularJS页面元素 [英] Selenium does not see AngularJS page elements

查看:102
本文介绍了硒没有看到AngularJS页面元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有写Selenium测试来检查我的应用程序的问题。当用户键入正确的登录/密码,正确的页面显示和用户登录我想测试。

I have problem with writing Selenium test to check my application. What I want to test is when user types correct login/password, correct page is shown and user is logged in.

主要的问题是,我的登录表单作为AngularJS指令产生的(我有两个不同的登录页面,这指令在两地重复使用)和硒似乎是无法看到这个指令生成标记元素。
什么是最重要的,测试这个页面上走过时,我把它换成由指令产生的常规标记之前。

The main issue is that my login form is generated as a AngularJS directive (I have two different login pages and this directive is reused in both places) and Selenium seems to be unable to see elements from this directive-generated markup. What is most important, tests were passing on this page before I've replaced regular markup with generated by directive.

所以看起来莫名其妙硒是无法看到由指令生成的HTML元素。

So it looks like somehow Selenium is not able to see html elements that are generated by directive.

任何建议,我怎么能解决这个问题?当然除了恢复这种变化引入指令:)

Any suggestion how I could overcome this issue? Except of course reverting this change introducing directive :)

推荐答案

好吧,这看起来就像是我用硒滥用盖布。我没有指定默认的驱动程序和盖布挑选了一个与AngularJS工作。我手动更改Chrome浏览器的驱动程序后,一切都开始工作。

Ok, it looks like it was me misusing Geb with Selenium. I didn't specify default driver and Geb picked one not working with AngularJS. After I manually changed driver to Chrome, everything started to work.

这篇关于硒没有看到AngularJS页面元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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