2016-08-31 23 views
0

Java用に3.0.0-beta2のSeleniumを使用しています。プロキシを設定できません。私は多くのことを試しましたが、何も動いていません。Seleniumを使用してFirefox用のプロファイルを作成できません

`FirefoxProfile profile = new FirefoxProfile(); 
profile.setPreference("network.proxy.type", 1); 
profile.setPreference("network.proxy.http", "someproxy"); 
profile.setPreference("network.proxy.http_port", 3128); 
WebDriver driver = new FirefoxDriver(profile);` 

私はFirefox用geckodriverを使用しています:私は、私もこれを試してみました、

`String PROXY = "localhost:8080"; 
    DesiredCapabilities. 
    Proxy proxy = new Proxy(); 
    proxy.setHttpProxy(PROXY).setFtpProxy(PROXY).setSslProxy(PROXY) 
    .setSocksProxy(PROXY); 
    DesiredCapabilities cap = new DesiredCapabilities(); 
    cap.setCapability(CapabilityType.PROXY, proxy); 
    driver = new FirefoxDriver(cap);` 

を以下を試してみました。私はまた、プロキシ機能はまだサポートされていないhereを発見し、この
System.setProperty("webdriver.gecko.driver", ".\\lib\\geckodriver.exe");

などのシステムプロパティとして定義されます。プロキシを設定する方法はありますか?

答えて

0

[OK]を、私はダウングレードしたセレンを試すことができますし、プロキシを設定するには、setPreferenceメソッドが働いていました。

0

あなたはバージョン2ポイント何かにこの

`ProfilesIni allProfiles = new ProfilesIni(); 
FirefoxProfile profile = allProfiles.getProfile("default"); 
profile.setPreference("network.proxy.type", 1); 
profile.setPreference("network.proxy.http", "someproxy"); 
profile.setPreference("network.proxy.http_port", 3128); 
capabilities.setCapability("firefox_profile", profile);' 
+0

Shivshanker Mhadiwale Tried。 Din't仕事:( –

関連する問題