我不知道为什么这个量角器代码适用于弹出窗口。 我量角器版本:4.0.3 Chrome版本:chromedriver_2.22.exe无法点击量角器中的弹出确定按钮
下面的是,我得到
失败的错误消息:没有警报开放 (会话信息:铬= 52.0.2743.116) (驱动程序信息:chromedriver = 2.22.397933(1cab651507b88dec79b2b2a22d1943c01833cc1b),平台= Windows NT的6.1.7601 SP1 x86_64的) 堆栈: NoSuchAlertError:毫无戒备开 (会话信息:铬= 52.0.2743.116) (驾驶员信息:chromedriver = 2.22.397933(1cab651507b88dec79b2b2a22d1943c01833cc1b),platform = Windows NT 6.1.7601 SP1 x86_64)
0 。HTML脚本用于弹出
<div class="modal-content" modal-transclude=""><div class="popupAlert popupAlert-full marginNone ng-scope">
<div class="popup-header">
<h2 class="modal-title ng-binding" id="myModalLabel">You are leaving this page </h2>
</div>
<div class="popup-body">
<div class="row Margin0">
<p class="text ng-binding">By continuing all the SLI data will be lost.</p>
</div>
</div>
<div class="popup-footer">
<div class="row Margin0">
<a data-ng-click="cancel()" class="pull-right buttonLink2">Cancel
<button type="button" class="pull-right swc_button" focus-element="autofocus" data-dismiss="modal" ng-click="ok()">Ok</button>
</a></div><a data-ng-click="cancel()" class="pull-right buttonLink2">
</a></div><a data-ng-click="cancel()" class="pull-right buttonLink2">
</a></div></div>
量角器代码
变种popupAlert = browser.switchTo()警报();
var alertText = popupAlert.getText();
console.log(" Alert text :" +alertText);
popupAlert.accept();
// expect(popupAlert.accept).toBeDefined();
是的,我已经写了 –
browser.get(“URL)。 –
元素(by.linkText(linktext_locator))点击(); –