How to stop test execution in Selenium if an error occured?

0 votes
How to stop test execution in Selenium if an error occured?
Jul 4 in Selenium by Fatima
21 views

1 answer to this question.

0 votes

Hey Fatima, if you are using any try-catch block in your code and wants to stop the test execution if an error is caught, then you can use this in your catch block:

try {
   //code
} 
catch(Exception e){
   e.printStackTrace();
   System.exit(1)
}
answered Jul 4 by Abha
• 15,880 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer

Can anyone help me that how to run Selenium WebDriver test cases in Chrome?

Download the executable driver from: ChromeDriver Download Before ...READ MORE

answered Mar 29, 2018 in Selenium by nsv999
• 5,050 points
175 views
0 votes
1 answer

How to use JavaScript in selenium to click an Element?

Executing a click via JavaScript has some ...READ MORE

answered Apr 13, 2018 in Selenium by Shubham
• 13,110 points
9,722 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,050 points
255 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
621 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
248 views
0 votes
1 answer

How to run test scripts in Selenium using PhantomJS?

Hey @Shushil, you can run your test ...READ MORE

answered May 17 in Selenium by Abha
• 15,880 points
25 views