我无法在角度2应用程序中使用量角器识别元素 [英] I am not able to identify elements using protractor in angular 2 application
本文介绍了我无法在角度2应用程序中使用量角器识别元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的Angular 2应用程序的html.我正在用Chrome执行测试
Here is my html for angular 2 applications. I am executing my tests in chrome
<md-card-title _ngcontent-c10="" class="ra-card-title mat-card-title">
<a _ngcontent-c10="">Massachusetts Division of Banks Issues Decision Establishing Limit on Maximum Allowable Fee for Dishonored Checks for State - Chartered Financial Institutions</a>
</md-card-title>
<div _ngcontent-c10="" class="ra-card-header__footer">
<md-card-subtitle _ngcontent-c10="" class="ra-card-code mat-card-subtitle">BLN3594</md-card-subtitle>
<div _ngcontent-c10="" class="ra-card-menu">
<span _ngcontent-c10="" aria-haspopup="true" class="ra-card-menu-button">...</span>
<md-menu _ngcontent-c10="" role="menu" xposition="before" yposition="below">
<!---->
</md-menu>
</div>
</div>
<md-card-subtitle _ngcontent-c10="" class="ra-card-code mat-card-subtitle">BLN3594</md-card-subtitle>
我无法使用
element(by.xpath("//span[@class='ra-card-menu-button'])[0]")).click();
但是,如果我在javascript executor下面使用它,则可以正常工作.
But if I use below javascript executor , it is working fine.
var scrpt = "return document.getElementsByClassName('ra-card-menu-button')[0].click();";
browser.executeScript(scrpt).then(function(text) {
logger.log('info', 'Script is: ' + scrpt);
});
量角器版本为5.1.1.
protractor version is 5.1.1.
任何人都可以帮助我确定问题
Could anyone please help me to identify the issue
推荐答案
我能够使用webdriver命令
I was able to solve this issue using the webdriver command
还需要确定为什么我的页面说它不是角度页面,尽管页面是角度2的.
Yet to identify why my page says it is not angular page though it is deveoped in angular 2
这篇关于我无法在角度2应用程序中使用量角器识别元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文