File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
src/main/java/io/github/seleniumquery/browser/driver Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 1
1
package io .github .seleniumquery .browser .driver ;
2
2
3
3
import io .github .seleniumquery .SeleniumQueryConfig ;
4
- import io .github .seleniumquery .SeleniumQueryException ;
5
4
import io .github .seleniumquery .browser .driver .builders .*;
5
+ import org .apache .commons .logging .Log ;
6
+ import org .apache .commons .logging .LogFactory ;
6
7
import org .openqa .selenium .WebDriver ;
7
8
8
9
import java .util .concurrent .TimeUnit ;
14
15
*/
15
16
public class SeleniumQueryDriver {
16
17
18
+ private static final Log LOGGER = LogFactory .getLog (SeleniumQueryDriver .class );
19
+
17
20
private static final DriverBuilder DEFAULT_DRIVER_BUILDER = new HtmlUnitDriverBuilder ();
18
21
19
22
private DriverBuilder driverBuilder = DEFAULT_DRIVER_BUILDER ;
@@ -62,18 +65,19 @@ private void setDriverTimeout() { // TODO unit test
62
65
}
63
66
64
67
/**
65
- * Quits the WebDriver in use by this seleniumQuery browser.
68
+ * Quits, if exists, the WebDriver in use by this seleniumQuery browser.
66
69
*
67
70
* @since 0.9.0
68
71
*
69
72
* @return A self reference.
70
73
*/
71
74
public SeleniumQueryDriver quit () {
72
75
if (webDriver == null ) { // TODO unit test
73
- throw new SeleniumQueryException ("WebDriver was not initialized, you can't .quit() it." );
76
+ LOGGER .warn ("Called .quit() before initializing WebDriver, nothing was done." );
77
+ } else {
78
+ webDriver .quit ();
79
+ webDriver = null ;
74
80
}
75
- webDriver .quit ();
76
- webDriver = null ;
77
81
return this ;
78
82
}
79
83
You can’t perform that action at this time.
0 commit comments