2017-04-18 142 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

您可以将此答案标记为答案,以便其他有类似问题的人更容易认出它? –

相关问题