1919use Behat \Mink \Session ;
2020use Behat \Testwork \Tester \Result \TestResult ;
2121use Symfony \Component \EventDispatcher \EventSubscriberInterface ;
22+ use WebDriver \Exception as WebDriverException ;
2223
2324/**
2425 * @author Kamil Kokot <[email protected] > @@ -111,7 +112,9 @@ private function logScreenshot()
111112 return ;
112113 }
113114
114- $ this ->saveLog ($ session ->getScreenshot (), 'png ' );
115+ try {
116+ $ this ->saveLog ($ session ->getScreenshot (), 'png ' );
117+ } catch (WebDriverException $ exception ) {}
115118 }
116119
117120 /**
@@ -160,6 +163,8 @@ private function getStatusCode(Session $session)
160163 return $ session ->getStatusCode ();
161164 } catch (MinkException $ exception ) {
162165 return null ;
166+ } catch (WebDriverException $ exception ) {
167+ return null ;
163168 }
164169 }
165170
@@ -174,6 +179,8 @@ private function getCurrentUrl(Session $session)
174179 return $ session ->getCurrentUrl ();
175180 } catch (MinkException $ exception ) {
176181 return null ;
182+ } catch (WebDriverException $ exception ) {
183+ return null ;
177184 }
178185 }
179186
@@ -188,6 +195,8 @@ private function getResponseHeadersLogMessage(Session $session)
188195 return 'Response headers: ' . "\n" . print_r ($ session ->getResponseHeaders (), true ) . "\n" ;
189196 } catch (MinkException $ exception ) {
190197 return null ;
198+ } catch (WebDriverException $ exception ) {
199+ return null ;
191200 }
192201 }
193202
@@ -202,6 +211,8 @@ private function getResponseContentLogMessage(Session $session)
202211 return 'Response content: ' . "\n" . $ session ->getPage ()->getContent () . "\n" ;
203212 } catch (MinkException $ exception ) {
204213 return null ;
214+ } catch (WebDriverException $ exception ) {
215+ return null ;
205216 }
206217 }
207218}
0 commit comments