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 6125859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:17:50+00:00 2026-05-23T16:17:50+00:00

I have a selenium script and I need to write the failures to a

  • 0

I have a selenium script and I need to write the failures to a log file. For example if a page is not found or selenium.waitForPageToLoad expires. Instead of going straight to tearDown(), I would like to log why my script has stopped.

    selenium.open("/confluence/login.action?logout=true");
    selenium.type("os_username", "login");
    selenium.type("os_password", "pw");
    selenium.click("loginButton");

    selenium.waitForPageToLoad("10000");    
    selenium.click("title-heading");
    selenium.click("spacelink-INTR");
    selenium.waitForPageToLoad("10000");
    selenium.click("link=Create Issue Links");
    selenium.waitForPageToLoad("10000");
    selenium.click("quick-search-query");
    selenium.type("quick-search-query", "create issue links");
    selenium.click("quick-search-submit");
    selenium.waitForPageToLoad("100000");
    stoptime = System.currentTimeMillis();

Also would it be possible to skip a steap if it fails, right now if anything at all fails it will go straight to the teardown() method.
I am using java.

  • 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-23T16:17:51+00:00Added an answer on May 23, 2026 at 4:17 pm

    What you are asking is exception handling. If any of the steps in your tests fails then selenium will throw an exception and tests would stop. If you handle the exceptions using try catch then you should be able to achieve what you are looking for. As an example, see the code below. This would handle the initial page load timeout. Even if selenium.open fails, script will handle the exception and move ahead to next statement. You should read more about exception handling to find what is the best way to handle these exceptions.

    try{
    selenium.open("/confluence/login.action?logout=true");
    }
    catch(Exception e)
    {
    //Code to write data to a file goes here
    System.out.println("Selenium open did not work")
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have file cabybara.rb in features/support (Content: Capybara.javascript_driver = :selenium) My test script is
I am using selenium IDE and i have to generate a script, in which
I have a python script that uses selenium RC; specifically webdriver. I would love
I have few questions on this as selenium always need windowid to get control
I have a Perl script that uses Selenium to fetch a HTML document called
I have a selenium script that I created with Selenium IDE. I was wondering
We have a headless selenium running as part of a maven build script using
I have a simple script ... dir=`pwd` echo $dir cd ./selenium-grid-1.0.8/ CMD=ant -Dport=$1 -Dhost=$2
I have Selenium running under Cruise Control to test our site once a day.
I have a Selenium test case that enters dates into a date selector made

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.