10000 PhantomJSDriverBuilder#withPathToPhantomJsExe() ->#withPathToPhantomJ… · seleniumQuery/seleniumQuery@9f1b168 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9f1b168

Browse files
committed
PhantomJSDriverBuilder#withPathToPhantomJsExe() ->#withPathToPhantomJS() - see #81
1 parent 9a89227 commit 9f1b168

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

src/main/java/io/github/seleniumquery/browser/BrowserFunctionsWithDeprecatedFunctions.java

Lines changed: 3 additions & 3 del 10000 etions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ public class OldBrowserFunctions {
8282
* @return A self reference. */
8383
public OldBrowserFunctions setDefaultDriverAsPhantomJS() { browser.driver().usePhantomJS(); return this; }
8484

85-
/** @deprecated Use: <code>$.driver().usePhantomJS().withPathToPhantomJsExe(path);</code>
86-
* @param path path to phantomjs.exe.
85+
/** @deprecated Use: <code>$.driver().usePhantomJS().withPathToPhantomJS(path);</code>
86+
* @param path path to PhantomJS executable (<code>phantomjs.exe</code>/<code>phantomjs.exe</code>).
8787
* @return A self reference. */
88-
public OldBrowserFunctions setDefaultDriverAsPhantomJS(String path) { browser.driver().usePhantomJS().withPathToPhantomJsExe(path); return this; }
88+
public OldBrowserFunctions setDefaultDriverAsPhantomJS(String path) { browser.driver().usePhantomJS().withPathToPhantomJS(path); return this; }
8989

9090
/** @deprecated Use: <code>$.driver().get();</code>
9191
* @return the currently set {@link WebDriver}. */

src/main/java/io/github/seleniumquery/browser/driver/builders/PhantomJSDriverBuilder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class PhantomJSDriverBuilder extends DriverBuilder<PhantomJSDriverBuilder
2525
"(2) on the path specified by the \"" + PHANTOMJS_EXECUTABLE_SYSTEM_PROPERTY + "\" system property; or\n" +
2626
"(3) on a folder in the system's PATH variable; or\n" +
2727
"(4) on the path set in the \""+PHANTOMJS_EXECUTABLE_SYSTEM_PROPERTY+"\" capability; or\n" +
28-
"(5) wherever and set the path via $.driver.usePhantomJS().withPathToPhantomJsExe(\"other/path/to/phantomjs.exe\").\n" +
28+
"(5) wherever and set the path via $.driver.usePhantomJS().withPathToPhantomJS(\"other/path/to/phantomjs<.exe>\").\n" +
2929
"For more information, see https://github.com/seleniumQuery/seleniumQuery/wiki/seleniumQuery-and-PhantomJS-Driver";
3030

3131
private static final String BAD_PATH_PROVIDED_EXCEPTION_MESSAGE = "The PhantomJS executable file was not found (or is a directory) at \"%s\"." + EXCEPTION_MESSAGE;
@@ -35,11 +35,11 @@ public class PhantomJSDriverBuilder extends DriverBuilder<PhantomJSDriverBuilder
3535
private String customPathToPhantomJs;
3636

3737
/**
38-
* Sets the path used by the PhantomJSDriver to find the phantomjs executable.
39-
* @param pathToPhantomJs Path to phantomjs.exe.
38+
* Sets the path used by the PhantomJSDriver to find the PhantomJS executable.
39+
* @param pathToPhantomJs Path to PhantomJS executable (<code>phantomjs.exe</code>/<code>phantomjs.exe</code>).
4040
* @return A self reference.
4141
*/
42-
public PhantomJSDriverBuilder withPathToPhantomJsExe(String pathToPhantomJs) {
42+
public PhantomJSDriverBuilder withPathToPhantomJS(String pathToPhantomJs) {
4343
this.customPathToPhantomJs = pathToPhantomJs;
4444
return this;
4545
}

src/test/java/io/github/seleniumquery/browser/driver/builders/PhantomJSDriverBuilderTest.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
public class PhantomJSDriverBuilderTest {
1616

17+
String phantomExecutable = PhantomJSDriverBuilder.PHANTOMJS_EXE;
18+
1719
@After
1820
public void tearDown() throws Exception {
1921
$.quit();
@@ -33,13 +35,13 @@ public void withCapabilities() {
3335

3436
@Test
3537
public void withCapabilities__should_return_the_current_PhantomJSDriverBuilder_instance_to_allow_further_chaining() {
36-
$.driver().usePhantomJS().withCapabilities(null).withPathToPhantomJsExe(null); // should compile
38+
$.driver().usePhantomJS().withCapabilities(null).withPathToPhantomJS(null); // should compile
3739
}
3840

3941
@Test
40-
public void withPathToPhantomJsExe() {
42+
public void withPathToPhantomJS() {
4143
// given
42-
$.driver().usePhantomJS().withPathToPhantomJsExe("src/test/resources/phantomjs.exe");
44+
$.driver().usePhantomJS().withPathToPhantomJS("src/test/resources/"+ phantomExecutable);
4345
// when
4446
$.url(classNameToTestFileUrl(SeleniumQueryBrowserTest.class));
4547
// then
@@ -49,8 +51,8 @@ public void withPathToPhantomJsExe() {
4951
@Test
5052
public void usePhantomJS__should_fall_back_to_systemProperty_when_executable_not_found_in_classpath() {
5153
// given
52-
PhantomJSDriverBuilder.PHANTOMJS_EXE = "not-in-classpath.exe";
53-
System.setProperty("phantomjs.binary.path", getFullPathForFileInClasspath("phantomjs.exe"));
54+
PhantomJSDriverBuilder.PHANTOMJS_EXE = "not-in-classpath.txt";
55+
System.setProperty("phantomjs.binary.path", getFullPathForFileInClasspath(phantomExecutable));
5456
// when
5557
$.driver().usePhantomJS();
5658
$.url(classNameToTestFileUrl(SeleniumQueryBrowserTest.class));

0 commit comments

Comments
 (0)
0