簡體   English   中英

Selenium C#InPrivate模式Internet Explorer

[英]Selenium C# InPrivate Mode Internet Explorer

使用Selenium C#運行自動測試時,我試圖以InPrivate模式啟動IE11。 找到了執行此操作的選項,但我似乎無法使我使用這些代碼行。

        InternetExplorerOptions options = new InternetExplorerOptions();
        options.ForceCreateProcessApi = true;
        options.BrowserCommandLineArguments = "-private";

        IWebDriver driver = new InternetExplorerDriver(options);
        return driver;

在任務管理器上可以看到該驅動程序,但是IE無法打開。 如果我通過InternetExplorerDriver刪除了選項,則可以正常工作。 因此,選項存在問題。 您對此有任何想法嗎?

謝謝!

很老的話題,但是萬一有人碰巧需要它……我偶然發現了一個類似的問題。

檢查您是否正在使用32位IE驅動程序。 我發現options.ForceCreateProcessApi = true;的困難方式options.ForceCreateProcessApi = true; 至少在我測試過的版本(3.4.0-3.8.0)中,此驅動程序將超時。 到目前為止,在這種設置下,我還沒有設法使私有模式適用於32位。

現在,我將其用作解決方法:

options.EnsureCleanSession = true;

這會大大降低測試速度,但至少會清除緩存。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM