私は1ヶ月以上の間、分娩器を使用しています。分度器asnchronus実行の問題
私は、それがすべて のステップがなど。
同期的に実行されていることを確認します、それは(http://www.protractortest.org/#/)を完了するために、角の呼び出しを待って、その分度器のドキュメントが言う知っているが、私はしないでくださいそのように見つけてください。または、少なくとも私のスクリプトでそれを見つけることはできません 例えば、リンクをクリックして現在のURLを取得し、次にURLを確認するなど、多くの時間引き出しが先に実行されます。
ほとんどの場合、URLの値は無効です。つまり、リンクをクリックしても実行されませんでした。以下は、ページオブジェクトと対応するテストのコードサンプルです。
すべてのテストステップが確実に実行されるように、の順番で実行してください。
Page Object
this.getSPageLink(){
return element(by.xpath("//a[@title='S']"));
};
this.getLPageLink(){
return element(by.xpath("//a[@title='L']"));
};
this.goToSPage = function() {
(this.getSPageLink()).click();
*//ERROR here, sometimes second click (below) doesn't wait for first
click to complete, and complains that link for 2 click (below) is
not found*
(this.getSLPageLink()).click();
return browser.currentURL();
*//ERROR HERE url line (e) is sometimes executed before*
}
Test Class
it('::test SL page', function() {
pageObject.goToSpage();
var currentURL=browser.getCurrentURL();
expect(currentURL).toContain("SLink");
*//ERROR HERE value in this variable "currentURL" is most of the
times Stale*
});
it('::test SL2 page', function() {
pageObject.goToLpage();
var currentURL=browser.getCurrentURL();
expect(currentURL).toContain("Link");
console.log("this line is always executed first"));
//ERROR here , this print line is always executed first
});
ありがとうございました。 – sathya
また、すべてのテスト行(ITブロック)が連続して実行されるようにするには、好ましい方法がありますか?たとえば、console.logは常に存在する順序ではなく、最初に実行されます。 – sathya
webdriverjs/protractor bindings ..http://stackoverflow.com/a/34377095/771848には、実際に500ミリ秒のポーリング間隔はありません。ありがとう。 – alecxe