Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7533555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:45:32+00:00 2026-05-30T05:45:32+00:00

When a test tries to open a page that doesn’t load, and the timeout

  • 0

When a test tries to open a page that doesn’t load, and the timeout value is reached, the test doesn’t stop or throw an exception. Instead it just moves on and acts as if the page is loaded successfully. It does its clicks and stops at the first assertion that returns false.

I found this in the commit log of PHPUnit 3.6.10: https://github.com/sebastianbergmann/phpunit/commit/cb772b06e9bd97f478fff7a212e3a4f7fe96bc29

In the source: https://github.com/sebastianbergmann/phpunit/blob/5d0ff52bdff9afd479e38fdc880adce453ce88e5/PHPUnit/Framework/TestResult.php#L665

The exception looks like it should still be caught, but unfortunately the exception doesn’t seem to trigger the test to stop, so I am at a loss of what to do here.

Here is an example test to provoke the behaviour I am talking about:

<?php
class Example extends PHPUnit_Extensions_SeleniumTestCase
{
    protected function setUp() {
        $this->setBrowser('*firefox');
        $this->setBrowserUrl('http://myserver/timeout.php');
        $this->setTimeout(10);
        $this->setWaitForPageToLoad(true);
    }

    public function testMyTestCase() {
        // This should trigger an exception after timeout:
        $this->openAndWait('/');

        // Anything below this line SHOULD never be executed because of timeout:
        $this->click('id=clicketyclickthiswontbeclicked');
        $this->click('id=moreclicksthatwillnotbeclicked');

        // This will fail the test, because timeout didn't stop it
        $this->assertTextPresent('this text');
    }
}
?>

The following PHP file should trigger a timeout.

timeout.php:

<?php

// Should trigger timeout
sleep(30);

// (...) Rest of the page

?>

Am I doing something wrong or could this be a bug?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T05:45:34+00:00Added an answer on May 30, 2026 at 5:45 am

    I’m going to answer myself here in case anyone else has this problem. As a workaround, I override the waitForPageToLoad function. It calls the parent function and keeps track of the time it spends waiting for the page to load to determine if the page load actually timed out, and throws an exception if it did.

    Here’s the code for it:

    protected function waitForPageToLoad( $timeout=null ) {
        if ( is_null( $timeout ) ) {
            $timeout = 30000;
        }
        $start = time();
        parent::waitForPageToLoad( $timeout );
        $end = time();
        if ( ($end - $start) >= ($timeout / 1000) ) {
            throw new Exception( 'Timed out after '.$timeout.'ms.' );
        }
    }
    

    This seems incredibly unnecessary, but at the moment, it works for me, but I would still like an answer that doesn’t require such a hack.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page located at x.com. On this page is a button that,
I have an iframe that pops up on an HTML page. In the iframe
I have a HTML page in which I have a button; pressing that button
I have a page which clients sometimes leave open for extended periods of time
I'm doing an admin page that can view the users that exist in the
i have class named Group i tried to test configuration: var cfg = new
UPDATE 3: I created a Visual Studio 2008 test project and tried to create
Has anybody tried any Unit Test generators for .Net? I assume although it won't
i have tried this: <?php $fileip = fopen(test.txt,r); ?> this should have opened the
I created a simple test with SendKeys, and tried both SendWait and Send. Private

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.