我試圖找出爲什麼.click()
下面是崩潰量角器:量角器element.click()拋出一個異常
this.clickSecondPanel = function() {
element(by.css('div.panels-gs.panel-top-two-gs')).click();
}
,直到我改變了線路:
element(by.css('div.panels-gs.panel-top-two-gs')).click;
在我的天賦。 JS看起來像:
var DataCardPage = require('./pageObjects/dataCard.page.js');
var dataCardPage = new DataCardPage();
describe('Clicking on the 2nd panel', function() {
dataCardPage.clickSecondPanel();
it('Should select the 2nd test panel', function() {
expect(dataCardPage.getSecondPanelText()).toBe('TEST123');
});
在我的代碼中的其他地方,我用.click()
(其中p arenths),所以這讓我感到困惑。
的錯誤是討厭的:
Started
[17:44:23] E/launcher - Error while waiting for Protractor to sync with the page
: "window.angular is undefined. This could be either because this is a non-angu
lar page or because your test involves client-side navigation, which can interfe
re with Protractor's bootstrapping. See http://git.io/v4gXM for details"
知道的任何意見...
鮑勃
嗯測試是否實際執行點擊?還是它不再拋出錯誤? – Gunderson
我也有點好奇。我明天早上會覈實一下。順便說一句,如果我將browser.pause()和「repl」設置爲cmd行模式,我可以將完全相同的代碼行成功發送到瀏覽器。我已經明確地做了一些奇怪的事情,或者Angular應用程序突然在這一點上出現異常。 .. –
是的,我無法想象它會如何點擊,它應該肯定是'click()'作爲一個函數。我只想說的其他事情就是將'clickSecondPanel()'移動到'it'塊中,不知道這是否會影響控制流?但本身看起來很可疑。否則,我會看下面的答案和/或確保'ng-app'在
上,如果不需要在你的配置中的其他地方指定'rootElement'。 – Gunderson