2017-02-18 8 views
2

単純な登録フォームを自動化してラムをしようとしていますが、「失敗:Fnは関数ではありません。以下は、私のコードの下ログインページのe2eを自動化しようとすると「失敗:Fnは関数ではありません」

describe('Locator testing by model', function(){ 

    it('automate user register form', function(){ 
     browser.get('http://www.way2automation.com/angularjs-protractor/registeration/#/login'); 
     element(by.model('Auth.user.name')).sendKeys('angular'); 
     element(by.model('Auth.user.password')).sendKeys('password'); 
     element(by.model('model[options.key]')).sendKeys('zafaque'); 
     element(by.buttonText('Login')).click(); 
     browser.wait(3000); 
    }); 
}); 

はあなたが間違ってbrowser.wait()を使用しているエラーの詳細

1) Locator testing by model automate user register form 
    Message: 
    Failed: fn is not a function 
    Stack: 
    TypeError: fn is not a function 
     at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:716:14 
     at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14) 
     at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21) 
     at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2820:25 
     at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7 
     at process._tickCallback (node.js:369:9) 
    From: Task: <anonymous> 
     at pollCondition (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2359:16) 
     at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2355:9 
     at new ManagedPromise (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1082:7) 
     at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2354:14 
     at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14) 
     at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21) 
     at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2775:27 
     at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7 
     at process._tickCallback (node.js:369:9) 
    From: Task: <anonymous wait> 
     at ControlFlow.wait (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2352:17) 
     at Driver.wait (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:712:29) 
     at ProtractorBrowser.to.(anonymous function) [as wait] (/usr/local/lib/node_modules/protractor/built/browser.js:60:29) 
     at Object.<anonymous> (/Users/zafaque/WebstormProjects/autotation/udemyProject/loginTest.js:12:17) 
     at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:94:23 
     at new ManagedPromise (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1082:7) 
     at controlFlowExecute (/usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:80:18) 
     at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14) 
     at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21) 
     at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2820:25 
    From: Task: Run it("automate user register form") in control flow 
     at Object.<anonymous> (/usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:79:14) 
    From asynchronous test: 
    Error 
     at Suite.<anonymous> (/Users/zafaque/WebstormProjects/autotation/udemyProject/loginTest.js:6:5) 
     at Object.<anonymous> (/Users/zafaque/WebstormProjects/autotation/udemyProject/loginTest.js:4:1) 
     at Module._compile (module.js:409:26) 
     at Object.Module._extensions..js (module.js:416:10) 
     at Module.load (module.js:343:32) 
     at Function.Module._load (module.js:300:12) 

答えて

3

されています。

最初の引数が関数または webdriver.promise.Promise又は期待できる条件である以下の順序でのparamsを受け入れる)(正しい使用方法についてhere

browser.waitを公式ドキュメントを参照条件2番目の引数は タイムアウトです

しかし、最初の引数としてタイムアウトを渡しています。あなたはちょうど無条件の待ちを待っている - ちょうど使用するbrowser.sleep(3000)

+0

ありがとうAdityaそれは働いた –