如何使用網絡驅動程序在Firefox中實現「Rememeber me」自動化?我正在使用Web驅動程序2.20,Eclipse IDE,Firefox 9.0如何實現使用web驅動程序在Firefox中記住自動化?
1
A
回答
0
您遇到這種情況的原因是因爲每次啓動firefox時,webdriver都會創建一個沒有cookie的新匿名配置文件。你可以讓它使用一個特定的配置文件,它應該保留cookie。
File profileDir = new File("path/to/profile");
FirefoxProfile profile = new FirefoxProfile(profileDir);
WebDriver driver = new FirefoxDriver(profile);
FirefoxProfile有許多其他選項,如添加擴展名和全部。
+0
已創建自定義配置文件並使用相同的配置文件,但它仍在清除cookie。 – ShravRao 2012-07-23 12:33:02
0
我知道你需要一個Firefox的解決方案,但我有Chrome的以下工作版本。你可以參考這個鏈接的Firefox解決方案:How to start Selenium RemoteWebDriver or WebDriver without clearing cookies or cache?
對於Chrome(config):你必須設置路徑到user-dir,這將保存所有的登錄信息,第一次登錄後。下一次再次登錄時,將從用戶目錄登錄信息。
System.setProperty("webdriver.chrome.driver", "res/chromedriver.exe");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
options.addArguments("start-maximized");
options.addArguments("user-data-dir=D:/temp/");
capabilities.setCapability("chrome.binary","res/chromedriver.exe");
capabilities.setCapability(ChromeOptions.CAPABILITY,options);
WebDriver driver = new ChromeDriver(capabilities);
登錄的第一次:
driver.get("https://gmail.com");
//Your login script typing username password, check 'keep me signed in' and so on
關閉驅動程序(不退出):
driver.close();
重新初始化驅動器,然後導航到該網站。你不應該再次被要求輸入用戶名和密碼:
driver = new ChromeDriver(capabilities);
driver.get("http://gmail.com");
以上可以使用firefox配置文件爲Firefox實現。
相關問題
- 1. 如何使用硒web驅動程序自動化OTP?
- 2. 如何在selenium Web驅動程序中自動化SOAP UI
- 3. 使用Ruby Selenium Web驅動程序進行測試自動化
- 4. 使用Selenium Web驅動程序進行Flash自動化
- 5. 如何在Web應用程序中實現自動註銷?
- 6. 自定義驅動程序的實現
- 7. 實現ODBC驅動程序
- 8. 使用硒web驅動程序自動化Adobe PDF Web窗體(XFA)
- 9. 在python中,selenium模塊。如何使用Firefox驅動程序
- 10. 像web應用程序中的谷歌驅動器的實現
- 11. 如何在Selenium中使用Mozilla Marionette Web驅動程序時禁用Web驅動程序例外
- 12. 使用Selenium Web驅動程序自動註冊流程
- 13. 如何在WPF應用程序中實現「記住我」
- 14. Selenium使用哪些Firefox驅動程序?
- 15. 自動化Win32驅動程序測試
- 16. 自動化Windows驅動程序版本
- 17. Selenium Web驅動程序的報告自動化
- 18. Selenium Web驅動程序自動化不能正常工作
- 19. 如何實例化並使用dma驅動程序linux模塊
- 20. PoolingDataSource - 如何使用特定於驅動程序的PreparedStatement實現
- 21. 如何實現自定義的mongodb驅動程序
- 22. 學習在Python中使用Assert和Asserttrue來實現硒web驅動程序
- 23. Web Scrapping自動化程序
- 24. 我們如何在testcomplete中實現關鍵字驅動的自動化框架
- 25. 如何在ANDROID中實現/調試傳感器驅動程序
- 26. 如何在驅動程序的sysfs中實現timer expire函數。
- 27. 如何在文件系統驅動程序中實現IOCTL_REDIR_QUERY_PATH?
- 28. 如何使用Selenium啓動Safari Web驅動程序?
- 29. 如何啓動自寫驅動程序
- 30. 對象實例 - Selenium Web驅動程序
記住我自動化是什麼意思?請添加更多詳情。 – vidit 2012-07-11 16:31:35
我有用戶名,密碼和記憶複選框登錄頁面。通過選中記錄複選框並關閉瀏覽器來自動登錄。如果我再次嘗試登錄,它會要求我提供憑據。 預期行爲:無需申請憑據即可登錄。 在IE中它工作正常,但在Firefox中,rememberme cookie被清除,並且不會登錄。 – ShravRao 2012-07-20 11:41:07