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

  • Home
  • SEARCH
  • 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 8374763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:59:53+00:00 2026-06-09T14:59:53+00:00

I have a suite of Selenium tests. Sometimes, for example, an ‘assertIsElementPresent’ will fail.

  • 0

I have a suite of Selenium tests. Sometimes, for example, an ‘assertIsElementPresent’ will fail. In certain circumstances, this may be because someone broke something and the result of the sequence of UI clicking is an error that has resulted in the site’s error page being shown.

How do I check if this has happened for every single failure, without having to implement a call to the below method everwhere?

    $isErrorPage = $selenium->isElementPresent("id=siteErrorPage");
    if ($isErrorPage){
        $html = $selenium->getHtmlSource();
        //send the $html to devs, log it, etc.
    }

The intention is simply to email the html source of the page that’s being shown if the page has turned out to be an error page.

  • 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-06-09T14:59:54+00:00Added an answer on June 9, 2026 at 2:59 pm

    I looks like you would have to extend the PHPUnit_Extensions_Selenium2TestCase class, and overload onNotSuccessfulTest(). Add your code in there and make all your testcases extend your new class instead of PHPUnit_Extensions_Selenium2TestCase. Make sure to call parent::onNotSuccessfulTest() in your extended version.

    I haven’t tested this, but from studying the code, this should get you what you want. Looks like the stop() command is sent on session __destruct(), so the session should still be active when you go to try and get your screenshot.

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

Sidebar

Related Questions

Background: We have web based product and a growing suite of automated Selenium tests
I have a test suite DLL written in C# that uses Selenium.This is then
We have a suite of Selenium tests. I'd like to use SimpleCov to coverage
I have a suite of Selenium tests (created using Java in Selenium RC 1.0.3)
We currently have a suite of integration tests that run via MbUnit test suites.
I have a test suite to perform smoke tests. I have all my script
I have a test suite to perform smoke tests. I have all my script
I'm using TestNG to run Selenium based tests in Java. I have a bunch
I have a the following selenium test suite inheriting from the same base class,
I have a test method created using Selenium, something similar to this: [TestFixture] public

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.