1
1
/*
2
- * Copyright (c) 2015 seleniumQuery authors
2
+ * Copyright (c) 2016 seleniumQuery authors
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -39,12 +39,16 @@ public class InternalSeleniumQueryObjectFactory {
39
39
40
40
public static InternalSeleniumQueryObjectFactory instance () {
41
41
if (instance == null ) {
42
- instance = new InternalSeleniumQueryObjectFactory ();
42
+ instance = new InternalSeleniumQueryObjectFactory (new SeleniumQueryFunctions () );
43
43
}
44
44
return instance ;
45
45
}
46
46
47
- protected SeleniumQueryFunctions seleniumQueryFunctions = new SeleniumQueryFunctions ();
47
+ public InternalSeleniumQueryObjectFactory (SeleniumQueryFunctions seleniumQueryFunctions ) {
48
+ this .seleniumQueryFunctions = seleniumQueryFunctions ;
49
+ }
50
+
51
+ private final SeleniumQueryFunctions seleniumQueryFunctions ;
48
52
49
53
public SeleniumQueryObject create (WebDriver driver , By by , List <WebElement > elements , SeleniumQueryObject previous ) {
50
54
return create (this .seleniumQueryFunctions , driver , by , elements , previous );
@@ -58,7 +62,7 @@ public SeleniumQueryObject createWithInvalidSelector(WebDriver driver, List<WebE
58
62
return create (driver , getNoSelectorInvalidBy (), elements , previous );
59
63
}
60
64
61
- public SeleniumQueryObject createWithInvalidSelectorAndNoPrevious (WebDriver driver , List <WebElement > elements ) {
65
+ SeleniumQueryObject createWithInvalidSelectorAndNoPrevious (WebDriver driver , List <WebElement > elements ) {
62
66
return createWithInvalidSelector (driver , elements , SeleniumQueryObject .NOT_BUILT_BASED_ON_A_PREVIOUS_OBJECT );
63
67
}
64
68
@@ -70,11 +74,11 @@ SeleniumQueryObject createWithValidSelectorAndNoPrevious(WebDriver driver, Strin
70
74
return new SeleniumQueryObject (seleniumQueryFunctions , driver , getBy (selector ));
71
75
}
72
76
73
- By getBy (String selector ) {
77
+ private By getBy (String selector ) {
74
78
return SeleniumQueryBy .byEnhancedSelector (selector );
75
79
}
76
80
77
- By getNoSelectorInvalidBy () {
81
+ private By getNoSelectorInvalidBy () {
78
82
return SeleniumQueryBy .NO_SELECTOR_INVALID_BY ;
79
83
}
80
84
0 commit comments