# Selenium + Python: Abort a test after x minutes

Details

My test scenarios currently cover over 300 test cases. Everything is written in Python (3.8) and Selenium and all test cases are covered by exceptions.

At the moment there is only one possibility missing which can be used after X minutes when the current test aborts due to unavailability of the server / site and the next test is executed.

If this one should not work either, then it should best abort the complete test with a corresponding message.

Can I implement this with Selenium?

• Are using any frame work to run the tests ? – PDHide Apr 1 '20 at 20:31
• i use unittest with selenium in python – Mornon Apr 1 '20 at 21:02

There is a StackOverflow answer to it: https://stackoverflow.com/a/14920854/2252076

In summary:

# You start a function foo
p = multiprocessing.Process(target=foo, name="Foo", args=(10,))
p.start()

# Wait until the function ends or it takes 10 seconds
p.join(10)