2017-04-18 136 views
0

瀏覽模式我試圖通過RobotFramework的InPrivate模式打開IE如下:打開Internet Explorer中的InPrivate通過robotframework

${dc} Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.INTERNETEXPLORER sys, selenium.webdriver 
Log To Console ${dc} 
Set To Dictionary ${dc} ie.forceCreateProcessApi=${True} ie.browserCommandLineSwitches=-private 
Log To Console ${dc} 
Open Browser www.google.com ie desired_capabilitie=${dc} 

腳本是停留在最後一步,直到按Ctrl + C。有人知道如何解決這個問題嗎?

感謝您的幫助!

+0

我在我的系統上發現了這個問題。當我在Windows 64位上使用IEDriverServer 32位時會發生問題。 – ttvn

回答

0

下面的代碼對我的作品:

*** Settings *** 
Library Collections  
Library Selenium2Library 

*** Test Cases *** 
Test IE InPrivate 
    ${dc} Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.INTERNETEXPLORER sys, selenium.webdriver 
    Set To Dictionary ${dc} ignoreProtectedModeSettings ${True} 
    Set To Dictionary ${dc} ie.forceCreateProcessApi  ${True} 
    Set To Dictionary ${dc} ie.browserCommandLineSwitches=-private 
    Open Browser www.google.com ie desired_capabilitie=${dc} 

但是,請注意,爲了使forceCreateProcessApi設置工作的額外註冊表項需要添加:HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\TabProcGrowth = '0'。否則會出現以下錯誤:

WebDriverException: Message: Unexpected error launching Internet Explorer. Unable to use 
CreateProcess() API. To use CreateProcess() with Internet Explorer 8 or higher, the value 
of registry setting in 
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\TabProcGrowth must be '0'. 
+0

謝謝A. Kootstra。它也適用於我。 – ttvn

+0

您可以將此答案標記爲答案,以便其他有類似問題的人更容易認出它? –

相關問題