0

ログイン後にホームページに要素が見つかりません。分度器 - ホームページを読み込んだ後で要素を見つけることができません

シナリオ:ログアウトボタンでプロファイル名/アイコンをクリック&をクリックし

it('Signout', function() { 
       //tried with following code 
       //browser.waitForAngularEnabled(true); 
       //locator below 
       //var profileIcon=element(by.model('user')); 
       common.btnClk(homepage.profileIcon); 
       common.btnClk(homepage.FCS_signoutbtn); 
       browser.close(); 

      }); 

対処方法:ホームページが更新browser.refreshがあるときは() 。要素を見つけることしかできません。 この回避策を使用しないで解決策を提案してください。

ログ:

[31m- [39m[31mFailed: Timed out waiting for asynchronous Angular tasks to finish after 120 seconds. This may be because the current page is not an Angular application. Please see the FAQ for more details: https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular 
    While waiting for element with locator - Locator: by.model("user"). 
    The following tasks were pending: 
    - $timeout: function(){$rootScope.authenticated=false;$cookies.remove("access_token");$cookies.remove("organizationId");$cookies.remove("authenticated");$cookies.remove("user_infos");$cookies.remove("user_profile_infos");$cookies.remove("user_depts");ChatSocket.disconnect();$state.go('core.login',{},{reload:true});$rootScope.options={position:'toast-top-right',type:'error',iconClass:{name:'error'},timeout:'5000',extendedTimeout:'1000',html:false,closeButton:true,tapToDismiss:true,closeHtml:'<i class="fa fa-times"></i>'};var msg="Your Token is Expired!";$rootScope.openToast("Session Timeout",msg);}[39m 

Executed 2 of 2 specs[31m (1 FAILED)[39m in 2 mins 55 secs. 

[12:57:53] I/launcher - 0 instance(s) of WebDriver still running 
[12:57:53] I/launcher - chrome #01 failed 1 test(s) 
[12:57:53] I/launcher - overall: 1 failed spec(s) 
[12:57:53] E/launcher - Process exited with error code 1 

追加情報:真browser.ignoreSynchronization =で試してみました。 &は、xpath経由で、その動作します。しかし、私は角度のアプローチでテストしたい。 **ウェブサイトは角度サイト** を試してみました: browser.driver.manage()。window()。setSize(1280、1024); browser.ignoreSynchronization = false; allScriptsTimeout:160000, defaultTimeoutInterval:160000

解決策をご提案ください。

+0

browser.sleep(3000)を入力して試してみてください。 –

+0

試しても動作しません。提案ありがとう。 –

答えて

0

あなたのページには$timeoutが保留中のようです。 リフレッシュの種類が解決されると、ログイン/認証とページ変更(以前の約束が解決されないタイミング問題のようなもの)に関連して、その動作の背後にバグが存在する可能性があります。

この場合、新しいページが読み込まれる前に、最後のアクションとしてControlFlowを「空にする」必要があるかもしれません。多分あなたの開発者が助けることができます。

は回避策として、

browser.waitForAngularEnabled(false); //could empty Protractors/Seleniums ChangeDetection on the ControlFlow 
browser.waitForAngularEnabled(true); //will observe the ControlFlow for new promises again. 

もののをしようと、それはロングショットだと私はpatially推測している、あなたはそれを試してみることにしたい場合があります。

+0

あなたの提案に感謝Ernst Zwingli。 browser.waitForAngularEnabled(false);回避策は私のために働く。 –

関連する問題