在我的python項目中,登錄過程由HttpBasicAuth處理程序處理。得到響應後,我應該通過硒加載主頁。如何將HttpAuthentication傳遞給selenium webdriver
它應該如何完成?
它具有基礎。當基本URL由python-selenium加載時,彈出框會要求用戶名和密碼進行驗證。然後進入主頁面。
這裏有兩個步驟:
- 步驟1:登陸(使用HttpBasicAuth處理)
我使用HttpBasicAuth處理的原因是,當我打開我的網址它會打開一個彈出登錄窗口。由於我們不知道Selenium處理彈出窗口模式對話窗口的控制權,我們切換到HttpAuthentication。
(這是我需要建議的一部分。)
- 步驟2:獲取響應時,過程在硒中的其餘步驟後。
在這個中間部分,我使用HttpBasicAuth處理程序的響應進行身份驗證,以便Selenium可以繼續執行測試中的其他步驟。
我該如何在Selenium中對網站進行身份驗證?我是否必須使用HttpBasicAuthentication Response爲Selenium webdriver創建cookie以跳過登錄框?
[此問題]可能的重複(http://stackoverflow.com/questions/5672407/basic-authentication-in-selenium-2-set-up-for-firefoxdriver-chromedriver-and)。查看[Selenium常見問題](http://wiki.openqa.org/display/SEL/Selenium+Core+FAQ#SeleniumCoreFAQ-HowdoIuseSeleniumtologintositesthatsthatHTTPbasicauthentication%28wherethebrowsermakesamodaldialogaskingforcredentials%29%3F)for a answer。 – shamp00 2012-02-14 09:18:06