Is there way to wait internet connection before throw exception of element not found

is there way to wait internet connection before throw exception of element not found
because internet loss for 10 seconds the whole test fail