Protractor wait for the page to fully load












1















I'm trying to click on '0 - Bootstrapping' under Tutorial after going to https://docs.angularjs.org/tutorial, but Protractor is not waiting for the page to fully load, so I get an Error




Failed: Cannot read property 'click' of undefined




I tried manually waiting for the page to load using




browser.driver.sleep(10000);




but I still get the same Error.



conf.js



exports.config = {
// seleniumAddress: 'http://localhost:4444/wd/hub',
getPageTimeout : 12000000,
capabilities: {
'browserName': 'chrome'
},
specs: ['todo-spec.js'],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 1440000,
}
};


todo-spec.js



describe('angularjs homepage', function () {
it('should greet the named user', function () {
var dropdown = element.all(by.css('.dropdown')).first(),
dropdownToggle = dropdown.element(by.css('.dropdown-toggle')),
dropdownMenu = dropdown.element(by.css('.dropdown-menu')),
menuItem = dropdownMenu.all(by.tagName('li')).first();

browser.get('http://www.angularjs.org');
dropdownToggle.click();
menuItem.click();

expect(browser.getCurrentUrl()).toEqual('https://docs.angularjs.org/tutorial');
//waiting 10 seconds for the page to fully load
browser.driver.sleep(10000);
browser.waitForAngular();
});
it('', async function () {

/* tried waiting for the element to be present
var EC = protractor.ExpectedConditions;
var e = element.all(by.css('.nav-index-listing'))[0];
browser.wait(EC.presenceOf(e), 10000);

Failed: Cannot read property 'isPresent' of undefined
*/

//clicking '0 - Bootstrapping' under Tutorial
element.all(by.css('.nav-index-listing'))[0].click();
expect(element(by.cssContainingText('.pln', 'npm install')).isEnabled()).toBe(true);
// Failed: Cannot read property 'click' of undefined

});
});


Edit



Replaced



element.all(by.css('.nav-index-listing'))[0].click();
expect(element(by.cssContainingText('.pln', 'npm install')).isEnabled()).toBe(true);


by



        element.all(by.css('.nav-index-listing')).get(0).click();
browser.wait(protractor.ExpectedConditions.urlIs("https://docs.angularjs.org/tutorial/step_00"), 5000);
expect(browser.getCurrentUrl()).toEqual('https://docs.angularjs.org/tutorial/step_00');
expect(element(by.cssContainingText('.pln', 'npm install')).isEnabled()).toBe(true);


And got an Error




Failed: Wait timed out after 5001ms




If I remove browser.wait I get




Expected 'https://docs.angularjs.org/tutorial' to equal 'https://docs.angularjs.org/tutorial/step_00'.











share|improve this question

























  • Please read the solution, it mentions to use element.all(by.css('.nav-index-listing a')).get(0).click(); and not element.all(by.css('.nav-index-listing')).get(0).click();. You have to also mention the "a" tag in the selector.

    – Saddam Pojee
    Nov 26 '18 at 3:29













  • Is it solved? If yes, then please accept the solution.

    – Saddam Pojee
    Dec 6 '18 at 7:09
















1















I'm trying to click on '0 - Bootstrapping' under Tutorial after going to https://docs.angularjs.org/tutorial, but Protractor is not waiting for the page to fully load, so I get an Error




Failed: Cannot read property 'click' of undefined




I tried manually waiting for the page to load using




browser.driver.sleep(10000);




but I still get the same Error.



conf.js



exports.config = {
// seleniumAddress: 'http://localhost:4444/wd/hub',
getPageTimeout : 12000000,
capabilities: {
'browserName': 'chrome'
},
specs: ['todo-spec.js'],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 1440000,
}
};


todo-spec.js



describe('angularjs homepage', function () {
it('should greet the named user', function () {
var dropdown = element.all(by.css('.dropdown')).first(),
dropdownToggle = dropdown.element(by.css('.dropdown-toggle')),
dropdownMenu = dropdown.element(by.css('.dropdown-menu')),
menuItem = dropdownMenu.all(by.tagName('li')).first();

browser.get('http://www.angularjs.org');
dropdownToggle.click();
menuItem.click();

expect(browser.getCurrentUrl()).toEqual('https://docs.angularjs.org/tutorial');
//waiting 10 seconds for the page to fully load
browser.driver.sleep(10000);
browser.waitForAngular();
});
it('', async function () {

/* tried waiting for the element to be present
var EC = protractor.ExpectedConditions;
var e = element.all(by.css('.nav-index-listing'))[0];
browser.wait(EC.presenceOf(e), 10000);

Failed: Cannot read property 'isPresent' of undefined
*/

//clicking '0 - Bootstrapping' under Tutorial
element.all(by.css('.nav-index-listing'))[0].click();
expect(element(by.cssContainingText('.pln', 'npm install')).isEnabled()).toBe(true);
// Failed: Cannot read property 'click' of undefined

});
});


Edit



Replaced



element.all(by.css('.nav-index-listing'))[0].click();
expect(element(by.cssContainingText('.pln', 'npm install')).isEnabled()).toBe(true);


by



        element.all(by.css('.nav-index-listing')).get(0).click();
browser.wait(protractor.ExpectedConditions.urlIs("https://docs.angularjs.org/tutorial/step_00"), 5000);
expect(browser.getCurrentUrl()).toEqual('https://docs.angularjs.org/tutorial/step_00');
expect(element(by.cssContainingText('.pln', 'npm install')).isEnabled()).toBe(true);


And got an Error




Failed: Wait timed out after 5001ms




If I remove browser.wait I get




Expected 'https://docs.angularjs.org/tutorial' to equal 'https://docs.angularjs.org/tutorial/step_00'.











share|improve this question

























  • Please read the solution, it mentions to use element.all(by.css('.nav-index-listing a')).get(0).click(); and not element.all(by.css('.nav-index-listing')).get(0).click();. You have to also mention the "a" tag in the selector.

    – Saddam Pojee
    Nov 26 '18 at 3:29













  • Is it solved? If yes, then please accept the solution.

    – Saddam Pojee
    Dec 6 '18 at 7:09














1












1








1


0






I'm trying to click on '0 - Bootstrapping' under Tutorial after going to https://docs.angularjs.org/tutorial, but Protractor is not waiting for the page to fully load, so I get an Error




Failed: Cannot read property 'click' of undefined




I tried manually waiting for the page to load using




browser.driver.sleep(10000);




but I still get the same Error.



conf.js



exports.config = {
// seleniumAddress: 'http://localhost:4444/wd/hub',
getPageTimeout : 12000000,
capabilities: {
'browserName': 'chrome'
},
specs: ['todo-spec.js'],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 1440000,
}
};


todo-spec.js



describe('angularjs homepage', function () {
it('should greet the named user', function () {
var dropdown = element.all(by.css('.dropdown')).first(),
dropdownToggle = dropdown.element(by.css('.dropdown-toggle')),
dropdownMenu = dropdown.element(by.css('.dropdown-menu')),
menuItem = dropdownMenu.all(by.tagName('li')).first();

browser.get('http://www.angularjs.org');
dropdownToggle.click();
menuItem.click();

expect(browser.getCurrentUrl()).toEqual('https://docs.angularjs.org/tutorial');
//waiting 10 seconds for the page to fully load
browser.driver.sleep(10000);
browser.waitForAngular();
});
it('', async function () {

/* tried waiting for the element to be present
var EC = protractor.ExpectedConditions;
var e = element.all(by.css('.nav-index-listing'))[0];
browser.wait(EC.presenceOf(e), 10000);

Failed: Cannot read property 'isPresent' of undefined
*/

//clicking '0 - Bootstrapping' under Tutorial
element.all(by.css('.nav-index-listing'))[0].click();
expect(element(by.cssContainingText('.pln', 'npm install')).isEnabled()).toBe(true);
// Failed: Cannot read property 'click' of undefined

});
});


Edit



Replaced



element.all(by.css('.nav-index-listing'))[0].click();
expect(element(by.cssContainingText('.pln', 'npm install')).isEnabled()).toBe(true);


by



        element.all(by.css('.nav-index-listing')).get(0).click();
browser.wait(protractor.ExpectedConditions.urlIs("https://docs.angularjs.org/tutorial/step_00"), 5000);
expect(browser.getCurrentUrl()).toEqual('https://docs.angularjs.org/tutorial/step_00');
expect(element(by.cssContainingText('.pln', 'npm install')).isEnabled()).toBe(true);


And got an Error




Failed: Wait timed out after 5001ms




If I remove browser.wait I get




Expected 'https://docs.angularjs.org/tutorial' to equal 'https://docs.angularjs.org/tutorial/step_00'.











share|improve this question
















I'm trying to click on '0 - Bootstrapping' under Tutorial after going to https://docs.angularjs.org/tutorial, but Protractor is not waiting for the page to fully load, so I get an Error




Failed: Cannot read property 'click' of undefined




I tried manually waiting for the page to load using




browser.driver.sleep(10000);




but I still get the same Error.



conf.js



exports.config = {
// seleniumAddress: 'http://localhost:4444/wd/hub',
getPageTimeout : 12000000,
capabilities: {
'browserName': 'chrome'
},
specs: ['todo-spec.js'],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 1440000,
}
};


todo-spec.js



describe('angularjs homepage', function () {
it('should greet the named user', function () {
var dropdown = element.all(by.css('.dropdown')).first(),
dropdownToggle = dropdown.element(by.css('.dropdown-toggle')),
dropdownMenu = dropdown.element(by.css('.dropdown-menu')),
menuItem = dropdownMenu.all(by.tagName('li')).first();

browser.get('http://www.angularjs.org');
dropdownToggle.click();
menuItem.click();

expect(browser.getCurrentUrl()).toEqual('https://docs.angularjs.org/tutorial');
//waiting 10 seconds for the page to fully load
browser.driver.sleep(10000);
browser.waitForAngular();
});
it('', async function () {

/* tried waiting for the element to be present
var EC = protractor.ExpectedConditions;
var e = element.all(by.css('.nav-index-listing'))[0];
browser.wait(EC.presenceOf(e), 10000);

Failed: Cannot read property 'isPresent' of undefined
*/

//clicking '0 - Bootstrapping' under Tutorial
element.all(by.css('.nav-index-listing'))[0].click();
expect(element(by.cssContainingText('.pln', 'npm install')).isEnabled()).toBe(true);
// Failed: Cannot read property 'click' of undefined

});
});


Edit



Replaced



element.all(by.css('.nav-index-listing'))[0].click();
expect(element(by.cssContainingText('.pln', 'npm install')).isEnabled()).toBe(true);


by



        element.all(by.css('.nav-index-listing')).get(0).click();
browser.wait(protractor.ExpectedConditions.urlIs("https://docs.angularjs.org/tutorial/step_00"), 5000);
expect(browser.getCurrentUrl()).toEqual('https://docs.angularjs.org/tutorial/step_00');
expect(element(by.cssContainingText('.pln', 'npm install')).isEnabled()).toBe(true);


And got an Error




Failed: Wait timed out after 5001ms




If I remove browser.wait I get




Expected 'https://docs.angularjs.org/tutorial' to equal 'https://docs.angularjs.org/tutorial/step_00'.








javascript node.js angular jasmine protractor






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 16:04







Kedel Mihail

















asked Nov 25 '18 at 10:37









Kedel MihailKedel Mihail

247




247













  • Please read the solution, it mentions to use element.all(by.css('.nav-index-listing a')).get(0).click(); and not element.all(by.css('.nav-index-listing')).get(0).click();. You have to also mention the "a" tag in the selector.

    – Saddam Pojee
    Nov 26 '18 at 3:29













  • Is it solved? If yes, then please accept the solution.

    – Saddam Pojee
    Dec 6 '18 at 7:09



















  • Please read the solution, it mentions to use element.all(by.css('.nav-index-listing a')).get(0).click(); and not element.all(by.css('.nav-index-listing')).get(0).click();. You have to also mention the "a" tag in the selector.

    – Saddam Pojee
    Nov 26 '18 at 3:29













  • Is it solved? If yes, then please accept the solution.

    – Saddam Pojee
    Dec 6 '18 at 7:09

















Please read the solution, it mentions to use element.all(by.css('.nav-index-listing a')).get(0).click(); and not element.all(by.css('.nav-index-listing')).get(0).click();. You have to also mention the "a" tag in the selector.

– Saddam Pojee
Nov 26 '18 at 3:29







Please read the solution, it mentions to use element.all(by.css('.nav-index-listing a')).get(0).click(); and not element.all(by.css('.nav-index-listing')).get(0).click();. You have to also mention the "a" tag in the selector.

– Saddam Pojee
Nov 26 '18 at 3:29















Is it solved? If yes, then please accept the solution.

– Saddam Pojee
Dec 6 '18 at 7:09





Is it solved? If yes, then please accept the solution.

– Saddam Pojee
Dec 6 '18 at 7:09












2 Answers
2






active

oldest

votes


















4














First of all browser.driver.sleep(10000) is not required. For page load, you can use protractor.ExpectedConditions. It will reduce unnecessary waiting for 10 seconds, if the page is already loaded.



Secondly, there is a minor mistake in your code which is the root cause of your problem.



Change this line



element.all(by.css('.nav-index-listing'))[0].click();


To this



 element.all(by.css('.nav-index-listing')).get(0).click();


UPDATE:





  1. element.all(by.css('.nav-index-listing')) will only give you li elements which will pass the test. But clicking it, will not lead you to the desired page.

    Change it to:



    element.all(by.css('.nav-index-listing a')).get(0).click();  


  2. In this case, [0] will not work since the returned value is not an array. It is of type ElementArrayFinder. So, that's why .get(0) is required.



  3. It will be better if you check for below conditions too, for your test.



    browser.wait(EC.urlIs("https://docs.angularjs.org/tutorial/step_00"), 5000);    
    expect(browser.getCurrentUrl()).toEqual('https://docs.angularjs.org/tutorial/step_00');


    These conditions checks whether your current URL is https://docs.angularjs.org/tutorial/step_00 or not.








share|improve this answer


























  • Wow,Thanks a lot. I changed [0] to .get(0) and it really worked, even without waiting and stuff.But can you please explain why it works with .get(0) and not with [0], cause I supposed that .get(0) and [0] were just two ways of doing the same thing(getting the first elementt from an array).

    – Kedel Mihail
    Nov 25 '18 at 11:31













  • @KedelMihail I have updated the solution, to answer your question. As well as given some additional feedback which might help you.

    – Saddam Pojee
    Nov 25 '18 at 12:07











  • When I use browser.wait(EC.urlIs("https://docs.angularjs.org/tutorial/step_00"), 5000) I get - Failed: Wait timed out after 1002ms

    – Kedel Mihail
    Nov 25 '18 at 15:34













  • @KedelMihail This error is for different statement. It says, Failed: Wait timed out after 1002ms. That means there is 1 more "browser.wait" statement in your code, where you mentioned 1000ms as timeout and that failed.

    – Saddam Pojee
    Nov 25 '18 at 15:40



















0














Try using waitForAngualarEnabled(true) instead of expected wait which makes the protractor to wait until all the angular elements are loaded and add await in every line of your test.
down vote
accepted






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53466646%2fprotractor-wait-for-the-page-to-fully-load%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    First of all browser.driver.sleep(10000) is not required. For page load, you can use protractor.ExpectedConditions. It will reduce unnecessary waiting for 10 seconds, if the page is already loaded.



    Secondly, there is a minor mistake in your code which is the root cause of your problem.



    Change this line



    element.all(by.css('.nav-index-listing'))[0].click();


    To this



     element.all(by.css('.nav-index-listing')).get(0).click();


    UPDATE:





    1. element.all(by.css('.nav-index-listing')) will only give you li elements which will pass the test. But clicking it, will not lead you to the desired page.

      Change it to:



      element.all(by.css('.nav-index-listing a')).get(0).click();  


    2. In this case, [0] will not work since the returned value is not an array. It is of type ElementArrayFinder. So, that's why .get(0) is required.



    3. It will be better if you check for below conditions too, for your test.



      browser.wait(EC.urlIs("https://docs.angularjs.org/tutorial/step_00"), 5000);    
      expect(browser.getCurrentUrl()).toEqual('https://docs.angularjs.org/tutorial/step_00');


      These conditions checks whether your current URL is https://docs.angularjs.org/tutorial/step_00 or not.








    share|improve this answer


























    • Wow,Thanks a lot. I changed [0] to .get(0) and it really worked, even without waiting and stuff.But can you please explain why it works with .get(0) and not with [0], cause I supposed that .get(0) and [0] were just two ways of doing the same thing(getting the first elementt from an array).

      – Kedel Mihail
      Nov 25 '18 at 11:31













    • @KedelMihail I have updated the solution, to answer your question. As well as given some additional feedback which might help you.

      – Saddam Pojee
      Nov 25 '18 at 12:07











    • When I use browser.wait(EC.urlIs("https://docs.angularjs.org/tutorial/step_00"), 5000) I get - Failed: Wait timed out after 1002ms

      – Kedel Mihail
      Nov 25 '18 at 15:34













    • @KedelMihail This error is for different statement. It says, Failed: Wait timed out after 1002ms. That means there is 1 more "browser.wait" statement in your code, where you mentioned 1000ms as timeout and that failed.

      – Saddam Pojee
      Nov 25 '18 at 15:40
















    4














    First of all browser.driver.sleep(10000) is not required. For page load, you can use protractor.ExpectedConditions. It will reduce unnecessary waiting for 10 seconds, if the page is already loaded.



    Secondly, there is a minor mistake in your code which is the root cause of your problem.



    Change this line



    element.all(by.css('.nav-index-listing'))[0].click();


    To this



     element.all(by.css('.nav-index-listing')).get(0).click();


    UPDATE:





    1. element.all(by.css('.nav-index-listing')) will only give you li elements which will pass the test. But clicking it, will not lead you to the desired page.

      Change it to:



      element.all(by.css('.nav-index-listing a')).get(0).click();  


    2. In this case, [0] will not work since the returned value is not an array. It is of type ElementArrayFinder. So, that's why .get(0) is required.



    3. It will be better if you check for below conditions too, for your test.



      browser.wait(EC.urlIs("https://docs.angularjs.org/tutorial/step_00"), 5000);    
      expect(browser.getCurrentUrl()).toEqual('https://docs.angularjs.org/tutorial/step_00');


      These conditions checks whether your current URL is https://docs.angularjs.org/tutorial/step_00 or not.








    share|improve this answer


























    • Wow,Thanks a lot. I changed [0] to .get(0) and it really worked, even without waiting and stuff.But can you please explain why it works with .get(0) and not with [0], cause I supposed that .get(0) and [0] were just two ways of doing the same thing(getting the first elementt from an array).

      – Kedel Mihail
      Nov 25 '18 at 11:31













    • @KedelMihail I have updated the solution, to answer your question. As well as given some additional feedback which might help you.

      – Saddam Pojee
      Nov 25 '18 at 12:07











    • When I use browser.wait(EC.urlIs("https://docs.angularjs.org/tutorial/step_00"), 5000) I get - Failed: Wait timed out after 1002ms

      – Kedel Mihail
      Nov 25 '18 at 15:34













    • @KedelMihail This error is for different statement. It says, Failed: Wait timed out after 1002ms. That means there is 1 more "browser.wait" statement in your code, where you mentioned 1000ms as timeout and that failed.

      – Saddam Pojee
      Nov 25 '18 at 15:40














    4












    4








    4







    First of all browser.driver.sleep(10000) is not required. For page load, you can use protractor.ExpectedConditions. It will reduce unnecessary waiting for 10 seconds, if the page is already loaded.



    Secondly, there is a minor mistake in your code which is the root cause of your problem.



    Change this line



    element.all(by.css('.nav-index-listing'))[0].click();


    To this



     element.all(by.css('.nav-index-listing')).get(0).click();


    UPDATE:





    1. element.all(by.css('.nav-index-listing')) will only give you li elements which will pass the test. But clicking it, will not lead you to the desired page.

      Change it to:



      element.all(by.css('.nav-index-listing a')).get(0).click();  


    2. In this case, [0] will not work since the returned value is not an array. It is of type ElementArrayFinder. So, that's why .get(0) is required.



    3. It will be better if you check for below conditions too, for your test.



      browser.wait(EC.urlIs("https://docs.angularjs.org/tutorial/step_00"), 5000);    
      expect(browser.getCurrentUrl()).toEqual('https://docs.angularjs.org/tutorial/step_00');


      These conditions checks whether your current URL is https://docs.angularjs.org/tutorial/step_00 or not.








    share|improve this answer















    First of all browser.driver.sleep(10000) is not required. For page load, you can use protractor.ExpectedConditions. It will reduce unnecessary waiting for 10 seconds, if the page is already loaded.



    Secondly, there is a minor mistake in your code which is the root cause of your problem.



    Change this line



    element.all(by.css('.nav-index-listing'))[0].click();


    To this



     element.all(by.css('.nav-index-listing')).get(0).click();


    UPDATE:





    1. element.all(by.css('.nav-index-listing')) will only give you li elements which will pass the test. But clicking it, will not lead you to the desired page.

      Change it to:



      element.all(by.css('.nav-index-listing a')).get(0).click();  


    2. In this case, [0] will not work since the returned value is not an array. It is of type ElementArrayFinder. So, that's why .get(0) is required.



    3. It will be better if you check for below conditions too, for your test.



      browser.wait(EC.urlIs("https://docs.angularjs.org/tutorial/step_00"), 5000);    
      expect(browser.getCurrentUrl()).toEqual('https://docs.angularjs.org/tutorial/step_00');


      These conditions checks whether your current URL is https://docs.angularjs.org/tutorial/step_00 or not.









    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 25 '18 at 12:20

























    answered Nov 25 '18 at 11:14









    Saddam PojeeSaddam Pojee

    7289




    7289













    • Wow,Thanks a lot. I changed [0] to .get(0) and it really worked, even without waiting and stuff.But can you please explain why it works with .get(0) and not with [0], cause I supposed that .get(0) and [0] were just two ways of doing the same thing(getting the first elementt from an array).

      – Kedel Mihail
      Nov 25 '18 at 11:31













    • @KedelMihail I have updated the solution, to answer your question. As well as given some additional feedback which might help you.

      – Saddam Pojee
      Nov 25 '18 at 12:07











    • When I use browser.wait(EC.urlIs("https://docs.angularjs.org/tutorial/step_00"), 5000) I get - Failed: Wait timed out after 1002ms

      – Kedel Mihail
      Nov 25 '18 at 15:34













    • @KedelMihail This error is for different statement. It says, Failed: Wait timed out after 1002ms. That means there is 1 more "browser.wait" statement in your code, where you mentioned 1000ms as timeout and that failed.

      – Saddam Pojee
      Nov 25 '18 at 15:40



















    • Wow,Thanks a lot. I changed [0] to .get(0) and it really worked, even without waiting and stuff.But can you please explain why it works with .get(0) and not with [0], cause I supposed that .get(0) and [0] were just two ways of doing the same thing(getting the first elementt from an array).

      – Kedel Mihail
      Nov 25 '18 at 11:31













    • @KedelMihail I have updated the solution, to answer your question. As well as given some additional feedback which might help you.

      – Saddam Pojee
      Nov 25 '18 at 12:07











    • When I use browser.wait(EC.urlIs("https://docs.angularjs.org/tutorial/step_00"), 5000) I get - Failed: Wait timed out after 1002ms

      – Kedel Mihail
      Nov 25 '18 at 15:34













    • @KedelMihail This error is for different statement. It says, Failed: Wait timed out after 1002ms. That means there is 1 more "browser.wait" statement in your code, where you mentioned 1000ms as timeout and that failed.

      – Saddam Pojee
      Nov 25 '18 at 15:40

















    Wow,Thanks a lot. I changed [0] to .get(0) and it really worked, even without waiting and stuff.But can you please explain why it works with .get(0) and not with [0], cause I supposed that .get(0) and [0] were just two ways of doing the same thing(getting the first elementt from an array).

    – Kedel Mihail
    Nov 25 '18 at 11:31







    Wow,Thanks a lot. I changed [0] to .get(0) and it really worked, even without waiting and stuff.But can you please explain why it works with .get(0) and not with [0], cause I supposed that .get(0) and [0] were just two ways of doing the same thing(getting the first elementt from an array).

    – Kedel Mihail
    Nov 25 '18 at 11:31















    @KedelMihail I have updated the solution, to answer your question. As well as given some additional feedback which might help you.

    – Saddam Pojee
    Nov 25 '18 at 12:07





    @KedelMihail I have updated the solution, to answer your question. As well as given some additional feedback which might help you.

    – Saddam Pojee
    Nov 25 '18 at 12:07













    When I use browser.wait(EC.urlIs("https://docs.angularjs.org/tutorial/step_00"), 5000) I get - Failed: Wait timed out after 1002ms

    – Kedel Mihail
    Nov 25 '18 at 15:34







    When I use browser.wait(EC.urlIs("https://docs.angularjs.org/tutorial/step_00"), 5000) I get - Failed: Wait timed out after 1002ms

    – Kedel Mihail
    Nov 25 '18 at 15:34















    @KedelMihail This error is for different statement. It says, Failed: Wait timed out after 1002ms. That means there is 1 more "browser.wait" statement in your code, where you mentioned 1000ms as timeout and that failed.

    – Saddam Pojee
    Nov 25 '18 at 15:40





    @KedelMihail This error is for different statement. It says, Failed: Wait timed out after 1002ms. That means there is 1 more "browser.wait" statement in your code, where you mentioned 1000ms as timeout and that failed.

    – Saddam Pojee
    Nov 25 '18 at 15:40













    0














    Try using waitForAngualarEnabled(true) instead of expected wait which makes the protractor to wait until all the angular elements are loaded and add await in every line of your test.
    down vote
    accepted






    share|improve this answer




























      0














      Try using waitForAngualarEnabled(true) instead of expected wait which makes the protractor to wait until all the angular elements are loaded and add await in every line of your test.
      down vote
      accepted






      share|improve this answer


























        0












        0








        0







        Try using waitForAngualarEnabled(true) instead of expected wait which makes the protractor to wait until all the angular elements are loaded and add await in every line of your test.
        down vote
        accepted






        share|improve this answer













        Try using waitForAngualarEnabled(true) instead of expected wait which makes the protractor to wait until all the angular elements are loaded and add await in every line of your test.
        down vote
        accepted







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 26 '18 at 5:49









        MadhanMadhan

        26919




        26919






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53466646%2fprotractor-wait-for-the-page-to-fully-load%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Contact image not getting when fetch all contact list from iPhone by CNContact

            count number of partitions of a set with n elements into k subsets

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks