Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97762

Browser.wait doesn't wait by given milliseconds

$
0
0

So I am having issue with browser.wait with using protractor, mocha and chai. Basically a simple script I have created is basically:

var EC = protractor.ExpectedConditions;
describe('Personal information', function () {
    var EC = protractor.ExpectedConditions;

    this.timeout(5000);

    it('test', function (done) {

        browser.driver
            .then(() => browser.wait(EC.presenceOf(element(by.xpath("//root"), 1000, "timed out TEST")
            .then(() => done());
    });

as you can see I have added a function this.timeout(5000); which means after 5 seconds it would throw a error however I have entered inside the browser.wait a timeout after 1000 milliseconds which means after 1 seconds it should throw a error of time out after 1 second.

However it seems like it doesn't do that but instead waits 5 seconds and throws Error: Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. and I am so confused of what I am doing incorrect here. So here I am!

How can I be able to make it wait for the amount I have given?

To GUY UPDATE 2:

describe('Personal information', function () {
    var EC = protractor.ExpectedConditions;

    this.timeout(0);

    browser.wait(EC.presenceOf(element(by.xpath("//root"))), 1000, "timed out TEST");
    });

Viewing all articles
Browse latest Browse all 97762

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>