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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:19:37+00:00 2026-06-06T01:19:37+00:00

I am trying to port some of my WebDriver tests from JAVA to C#.

  • 0

I am trying to port some of my WebDriver tests from JAVA to C#. What I’m stuck on is the situation when the driver cannot find some element on the page, in JAVA I do :

if (second >= 10) fail("timeout - " + list);

so if something takes more than 10 seconds the test fails with the timeout message.
I tried a similar approach in C# with

if (sec >= 10) Debug.Fail("timeout : " + vList);

but this actually did not fail the test, but gave me an option to do so with the exception message box. That was a no no, I need my automatic test to fail outright on its own. Then I tried

if (sec >= 10) Assert.Fail("timeout : " + vList);

but this is throwing an unhandled exception error. Should I enclose the Assert.Fail in try/catch block? Or should I use something completely different to fail the test?

I am using MSTest, as mentioned in the topic.

EDIT: The exact message is :

AssertFailedException was unhandled by user code. Assert.Fail failed.
timeout : someField.

on

Assert.Fail(“timeout : ” + vList);

  • 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-06T01:19:38+00:00Added an answer on June 6, 2026 at 1:19 am

    I think you’re seeing that behaviour because you’ve got the debugger attached to the running test – Assert.Fail throws AssertFailedException, your debugger sees the exception and breaks – and you don’t get test results.

    On the Debug menu, go into Exceptions, find AssertFailedException (or create an entry for it if it’s not there) and make sure break on throw is turned off for that exception type.

    Alternatively, run your tests without the debugger attached.

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

Sidebar

Related Questions

I am trying to port some code from a regular Java program into the
This is my second time using C++ and I'm trying to port some Java
I'm trying to port some code from Play Framework Java to Play Framework Scala
I'm trying to port some java to jruby, and it uses a beans PropertyDescriptor.
I'm trying to port some functionality from my engine from c++ to C#. I
I'm trying to port some code from VC9 to G++, however Ive run into
I am trying to port some java code to scala. The code uses annotations
I'm trying to port some scripts from a modern version of Intersystems Cache back
I'm trying to port some Octave code to Java. I'm trying out atan2 so
I am trying to port some C++ code from Windows to Solaris(Unix). There are

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.