2016-10-01 6 views
0
次のように

私のコードは次のとおりです。セレンはアクセスできないウェブページ

public static void main(String[] args) { 
    WebDriver driver; 
    System.setProperty("webdriver.gecko.driver", "E:\\gecko\\geckodriver.exe"); 
    System.out.println("Gecko Driver Found"); 
    driver =new FirefoxDriver(); 
    System.out.println("WebDriver Established"); 
    driver.get("http://www.supremenewyork.com/shop/all/sweatshirts"); 
    System.out.println("Connection Established"); 
} 
} 

プログラムは、私が一番下にダンプしますドライバを確立しようとしたときに、これは私にSessionNotCreatedExceptionを与えて実行します。私はちょうどプログラムが今すぐWebページをロードするようにしようとしているので、どんな助けも素晴らしいだろう。

コンソール出力:ダニエル・チェンによって行われた編集に

Sep 30, 2016 10:26:37 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end 1475288797965 addons.xpi WARN Error loading bootstrap.js for {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}: Module resource://gre/modules/commonjs/sdk/addon/bootstrap.js is not found at resource://gre/modules/commonjs/sdk/addon/bootstrap.js (resource://gre/modules/commonjs/toolkit/require.js:24) JS Stack trace: make/[email protected]:24:12 < @bootstrap.js:10:23 < @XPIProvider.jsm:4339:1 < [email protected]:4339:7 < [email protected]:4414:1 < [email protected]:3334:1 < [email protected]:3443:23 < [email protected]:3604:34 < [email protected]:2092:25 < [email protected]:208:12 < [email protected]:667:5 < [email protected]:824:9 < [email protected]:2402:5 < [email protected]:55:7 1475288797965 addons.xpi WARN Exception running bootstrap method install on {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}: TypeError: this.bootstrapScopes[aAddon.id][aMethod] is not a function (resource://gre/modules/addons/XPIProvider.jsm:4442:8) JS Stack trace: [email protected]:4442:9 < [email protected]:3334:1 < [email protected]:3443:23 < [email protected]:3604:34 < [email protected]:2092:25 < [email protected]:208:12 < [email protected]:667:5 < [email protected]:824:9 < [email protected]:2402:5 < [email protected]:55:7 Sep 30, 2016 10:26:38 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Falling back to straight W3C remote end connection 1475288799084 addons.xpi WARN Error loading bootstrap.js for {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}: Module resource://gre/modules/commonjs/sdk/addon/bootstrap.js is not found at resource://gre/modules/commonjs/sdk/addon/bootstrap.js (resource://gre/modules/commonjs/toolkit/require.js:24) JS Stack trace: make/[email protected]:24:12 < @bootstrap.js:10:23 < @XPIProvider.jsm:4339:1 < [email protected]:4339:7 < [email protected]:4414:1 < [email protected]:3334:1 < [email protected]:3443:23 < [email protected]:3604:34 < [email protected]:2092:25 < [email protected]:208:12 < [email protected]:667:5 < [email protected]:824:9 < [email protected]:2402:5 < [email protected]:55:7 1475288799085 addons.xpi WARN Exception running bootstrap method install on {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}: TypeError: this.bootstrapScopes[aAddon.id][aMethod] is not a function (resource://gre/modules/addons/XPIProvider.jsm:4442:8) JS Stack trace: [email protected]:4442:9 < [email protected]:3334:1 < [email protected]:3443:23 < [email protected]:3604:34 < [email protected]:2092:25 < [email protected]:208:12 < [email protected]:667:5 < [email protected]:824:9 < [email protected]:2402:5 < [email protected]:55:7 Sep 30, 2016 10:26:40 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Falling back to original OSS JSON Wire Protocol. 1475288800182 addons.xpi WARN Error loading bootstrap.js for {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}: Module resource://gre/modules/commonjs/sdk/addon/bootstrap.js is not found at resource://gre/modules/commonjs/sdk/addon/bootstrap.js (resource://gre/modules/commonjs/toolkit/require.js:24) JS Stack trace: make/[email protected]:24:12 < @bootstrap.js:10:23 < @XPIProvider.jsm:4339:1 < [email protected]:4339:7 < [email protected]:4414:1 < [email protected]:3334:1 < XPI_pr[email protected]:3443:23 < [email protected]:3604:34 < [email protected]:2092:25 < [email protected]:208:12 < [email protected]:667:5 < [email protected]:824:9 < [email protected]:2402:5 < [email protected]:55:7 1475288800183 addons.xpi WARN Exception running bootstrap method install on {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}: TypeError: this.bootstrapScopes[aAddon.id][aMethod] is not a function (resource://gre/modules/addons/XPIProvider.jsm:4442:8) JS Stack trace: [email protected]:4442:9 < [email protected]:3334:1 < [email protected]:3443:23 < [email protected]:3604:34 < [email protected]:2092:25 < [email protected]:208:12 < [email protected]:667:5 < [email protected]:824:9 < [email protected]:2402:5 < [email protected]:55:7 Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, browserName=firefox, version=, platform=ANY}], required capabilities = Capabilities [{}] Build info: version: '3.0.0-beta4', revision: '3169782', time: '2016-09-29 10:29:23 -0700' System info: host: [REDACTED], ip: [REDACTED], os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_101' Driver info: driver.version: FirefoxDriver at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:80) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:602) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:129) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:247) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:235) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:230) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:226) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:124) at copDatBogo.SupremeAccesser.main(SupremeAccesser.java:11)

答えて

0

おかげで、私は例外をgopogle、問題を診断することができました。

firefoxを再インストールしましたが、新しいディレクトリにインストールしました。次のように私の最終的な機能コードは次のとおりです。

package copDatBogo; 
import java.io.File; 
import org.openqa.selenium.By; 
import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.firefox.FirefoxBinary; 
import org.openqa.selenium.firefox.FirefoxDriver; 
import org.openqa.selenium.firefox.FirefoxProfile; 
public class SupremeAccesser { 



public static void main(String[] args) { 
     WebDriver driver; 
     System.setProperty("webdriver.gecko.driver", "E:\\gecko\\geckodriver.exe"); 
     File pathToBinary = new File("path to firefox.exe"); 
     FirefoxBinary ffBinary = new FirefoxBinary(pathToBinary); 
     FirefoxProfile ffProfile = new FirefoxProfile(); 
     System.out.println("Gecko Driver Found"); 
     driver =new FirefoxDriver(ffBinary, ffProfile); 
     System.out.println("WebDriver Established"); 
     driver.get("URL"); 
     System.out.println("Connection Established"); 
    } 
} 

私は精彩を欠いた診断技術について謝罪し、将来的にはより徹底的にエラーメッセージをくします。

関連する問題