2011-06-16 116 views
0

我試圖自動化一個安全的應用程序(與useragent-iphone),當我打開該網站時要求身份驗證。我試圖在URL本身給憑據繞過驗證,但它彈出一個對話框進行確認,我無法通過代碼處理它。如何繞過硒身份驗證

FirefoxProfile profile = new FirefoxProfile();  
profile.setPreference("general.useragent.override", 
    "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420.1" 
    + "(KHTML, like Gecko) Version/3.0 Mobile/3B48b Safari/419.3)"); 
WebDriver driver = new FirefoxDriver(profile); 
String site = "http://akamai:[email protected]"; 
driver.get(site); 

對此的任何幫助都非常感謝。

感謝, Bhavana

+0

通過身份驗證您是否說「代理身份驗證」 – 2011-06-17 12:07:15

回答

0

您可以使用Selenium的新的webdriver將信息輸入到該類型的對話框。但是我沒有做到。

2

Mozilla阻止釣魚嘗試。你檢查了Network.http.phishy-userpass-length

順便提一下,根據Selenium's issue 34#8,這應該工作:

FirefoxProfile profile = new FirefoxProfile(); 
profile.setPreference("network.http.phishy-userpass-length", 255); 
driver = new FirefoxDriver(profile); 
driver.get("http://username:[email protected]/"); 

注:這個問題幾乎是一樣的BASIC Authentication in Selenium 2 - set up for FirefoxDriver, ChromeDriver and IEdriver