allowing phantomjs to use the grid

Project: http://git-wip-us.apache.org/repos/asf/nutch/repo
Commit: http://git-wip-us.apache.org/repos/asf/nutch/commit/521e325c
Tree: http://git-wip-us.apache.org/repos/asf/nutch/tree/521e325c
Diff: http://git-wip-us.apache.org/repos/asf/nutch/diff/521e325c

Branch: refs/heads/master
Commit: 521e325c7509f6afd5c9d8f7bf83afedc232ed9d
Parents: 7a7362c
Author: Kim Whitehall <[email protected]>
Authored: Sat Apr 16 12:45:52 2016 -0700
Committer: Kim Whitehall <[email protected]>
Committed: Sat Apr 16 12:45:52 2016 -0700

----------------------------------------------------------------------
 .../org/apache/nutch/protocol/selenium/HttpWebClient.java    | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nutch/blob/521e325c/src/plugin/lib-selenium/src/java/org/apache/nutch/protocol/selenium/HttpWebClient.java
----------------------------------------------------------------------
diff --git 
a/src/plugin/lib-selenium/src/java/org/apache/nutch/protocol/selenium/HttpWebClient.java
 
b/src/plugin/lib-selenium/src/java/org/apache/nutch/protocol/selenium/HttpWebClient.java
index 1feb093..8ec3fa9 100644
--- 
a/src/plugin/lib-selenium/src/java/org/apache/nutch/protocol/selenium/HttpWebClient.java
+++ 
b/src/plugin/lib-selenium/src/java/org/apache/nutch/protocol/selenium/HttpWebClient.java
@@ -42,6 +42,7 @@ import org.openqa.selenium.remote.DesiredCapabilities;
 import org.openqa.selenium.remote.RemoteWebDriver;
 import org.openqa.selenium.safari.SafariDriver;
 import org.openqa.selenium.phantomjs.PhantomJSDriver;
+import org.openqa.selenium.phantomjs.PhantomJSDriverService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -62,7 +63,7 @@ public class HttpWebClient {
       profile.setPreference("dom.ipc.plugins.enabled.libflashplayer.so", 
"false");
       profile.setPreference(FirefoxProfile.ALLOWED_HOSTS_PREFERENCE, 
"localhost");
       WebDriver driver = new FirefoxDriver(profile);
-      return driver;
+      return driver;          
     };
   };
 
@@ -122,7 +123,7 @@ public class HttpWebClient {
                 capabilities = DesiredCapabilities.phantomjs();
                 capabilities.setBrowserName("phantomjs");
                 capabilities.setJavascriptEnabled(true);
-                
capabilities.setCapability("phantomjs_binary",seleniumGridBinary);
+                
capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY,seleniumGridBinary);
                 driver = new RemoteWebDriver(new URL(seleniumHubProtocol, 
seleniumHubHost, seleniumHubPort, seleniumHubPath), capabilities);
                 break;
               default:
@@ -130,6 +131,7 @@ public class HttpWebClient {
                 driver = new RemoteWebDriver(new URL(seleniumHubProtocol, 
seleniumHubHost, seleniumHubPort, seleniumHubPath), 
DesiredCapabilities.firefox());
                 break;
             }
+            break;
           default:
             LOG.error("The Selenium WebDriver choice {} is not available... 
defaulting to FirefoxDriver().", driverType);
             driver = new FirefoxDriver();
@@ -184,7 +186,7 @@ public class HttpWebClient {
    */
   public static String getHtmlPage(String url, Configuration conf) {
     WebDriver driver = getDriverForPage(url, conf);
-
+    
     try {
       if (conf.getBoolean("selenium.take.screenshot", false)) {
         takeScreenshot(driver, conf);

Reply via email to