Element.isPresent() script timeout
See original GitHub issueHi!
I have an issue using protractor with jasmine, and I wonder if there is an issue with the framework, or if my limited knowledge of the framework plays against me. I found a fairly recent StackOverflow question with four upvotes but no answer so far, which leads me to think that something may be going wrong with the latest version of protractor.
Here is my test:
import {
browser,
ExpectedConditions,
$
} from 'protractor';
describe('When user click \"Test\" button', async () => {
beforeAll(async () => {
await browser.get('http://local.myawesomewebsite.com:4200');
expect(await browser.getCurrentUrl())
.toContain('myawesomewebsite');
browser.waitForAngularEnabled(true);
});
it ("should navigate to next page", async () => {
var testButton = $(".wrapper button");
browser.wait(
ExpectedConditions.presenceOf(testButton),
5000,
'Element taking too long to appear in the DOM'
);
expect(await testButton.isPresent())
.toBe(true);
await testButton.click();
});
describe("When user click button to open modal", async () => {
beforeAll(() => {
expect(browser.getCurrentUrl())
.toContain('next/page');
});
it("should make modal appear", async () => {
var popModalButton = await $(".wrapper button");
var overlay = await $('.overlay.active');
browser.wait(
ExpectedConditions.presenceOf(popModalButton),
5000,
'Element taking too long to appear in the DOM'
);
expect(await popModalButton.isPresent())
.toBe(true);
await popModalButton.click();
});
describe("When user clicks modal button", async () => {
it("should proceed to final page", async () => {
var proceedToFinalPageButton = await $(".cta.modal-not-empty button.continue-to-final-page");
await browser.wait(
ExpectedConditions.presenceOf(proceedToFinalPageButton),
5000,
'Element taking too long to appear in the DOM'
);
expect(await proceedToFinalPageButton.isPresent())
.toBe(true);
});
});
});
});
It all works great until the test reach the last attempt to detect if the modal popped out:
await browser.wait(
ExpectedConditions.presenceOf(proceedToFinalPageButton),
5000,
'Element taking too long to appear in the DOM'
);
expect(await proceedToFinalPageButton.isPresent())
.toBe(true);
This isPresent()
doesn’t return true
or false
, instead nothing happens and protractor stops and outputs the following error:
Failed: script timeout: result was not received in 11 seconds
Any idea what could be going wrong? Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:9
Top Results From Across the Web
protractor, script timeout after login procedure
isPresent(), so this is an easy question for the browser, and it just replies "no" since it is most likely not ... expect(await...
Read more >isPresent | API Reference
Determines if an element is present in the DOM. The command isPresent() will automatically wait for the element to be present (until the...
Read more >How do these failure durations make sense?
When it fails, it claims it was a ScriptTimeoutError and the timed out step is the one immediately after it switches to the...
Read more >angular/protractor
I extended the script timeout in the protractor config to 30 seconds in fear that the page was ... It won't be an...
Read more >Check Visibility of Web Elements Using Various Types ...
isEnabled() is the method used to verify if the web element is enabled ... Implementation of Our First WebDriver Script – Selenium WebDriver ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This just started happening for me. It’s very inconsistent. Sometimes it works for a decent amount of time and then sometimes it just keeps failing over and over. Are there any plans to fix this?
I experience more or less the same, I think it’s related to
browser.waitForAngularEnabled
If I globally do
browser.waitForAngularEnabled(false)
I can test both apps, but then I always have to “manually” wait until angular was fully loaded.So I tried to
browser.waitForAngularEnabled(false)
while I login in App 1 andbrowser.waitForAngularEnabled(true)
after I logged in there, then I want to redirect to the main app and do my testing. The result is the issue OP reported above.Looks like toggling
browser.waitForAngularEnabled
does not really work.