1

PhantomJS Driver を使用してヘッドレス テストを実行しようとしています。問題は次のとおりです: リダイレクトされた URL で作業できない ex URL: https://gmail.com

環境:phantomjs-1.9.7-windows ; ファントムjsdriver: 1.0.4 ; ジャント:4.8.1 ; セレンサーバー: 2.39.0

コンソール:

Feb 4, 2014 4:42:34 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: executable: C:\Users\xprk067\softwares\phantomjs-1.9.7-windows\phantomjs.exe
Feb 4, 2014 4:42:34 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: port: 7070
Feb 4, 2014 4:42:34 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: arguments: [--webdriver=7070]
Feb 4, 2014 4:42:34 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: environment: {}
PhantomJS is launching GhostDriver...
[ERROR - 2014-02-04T10:42:34.998Z] GhostDriver - main.fail - {"message":"Could not start Ghost Driver","line":82,"sourceId":79376088,"sourceURL":":/ghostdriver/main.js","stack":"Error: Could not start Ghost Driver\n    at :/ghostdriver/main.js:82","stackArray":[{"sourceURL":":/ghostdriver/main.js","line":82}]}
OUTPUT:blank

ここに私が使用したコードがあります

public class PhantamJS{

    private WebDriver driver;
    private WebDriver driver2;

    @Test
    public void  test(){                        

        **PhantomJSDriver to get the current URL  : Not Working**       
        Proxy proxy = new Proxy();
        PhantomJSDriverService driverService = new PhantomJSDriverService.Builder()
        .usingPhantomJSExecutable(new File("C:\\Users\\amar\\softwares\\phantomjs-1.9.7-windows\\phantomjs.exe"))
        .usingPort(7070)
        .build();
        final DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(CapabilityType.PROXY, proxy);
        driver2 = new PhantomJSDriver(driverService, capabilities);
        driver2.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
        driver2.get("https://gmail.com");           
        String currentURL2 = driver2.getCurrentUrl();             
System.out.println("OUTPUT" + currentURL2 );
    }
}
4

1 に答える 1