使用Selenium WebDriver,Chrome浏览器无法在信息亭模式下打开 [英] Chrome browser doesn't open in kiosk mode using Selenium WebDriver

查看:175
本文介绍了使用Selenium WebDriver,Chrome浏览器无法在信息亭模式下打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Selenium WebDriver与chrome浏览器一起使用,无论出于何种原因,它都无法在信息亭模式下打开.这曾经奏效,但不确定为什么会停止.

I am using Selenium WebDriver with chrome browser and for whatever reason, it doesn't open in kiosk mode. This used to work, not sure why it stopped.

这是我的代码:

        private IWebDriver GetChromeDriver(BrowserConfigurationOptions browserConfigOptions)
    {
        var options = new ChromeOptions();
        options.AddArguments("disable-infobars");
        options.AddUserProfilePreference("credentials_enable_service", false);
        if (browserConfigOptions.KioskModeForChrome)
            options.AddArgument("--kiosk"); //options.AddArgument("--enable-kiosk-mode");
        LogChromeOptions(options);

        return new ChromeDriver(options);
    }

这是我的环境

  • Chrome 66
  • Selenium WebDriver v 3.11.2
  • Chromedriver version 2.38.0.1 from this Nuget package

我尝试传递--kiosk和--enable-kiosk-mode没有成功.

I've tried passing in --kiosk and --enable-kiosk-mode with no success.

推荐答案

看到除我以外的每个人都在工作,我开始进一步研究.深入研究代码后,我发现

After seeing that everyone had this working except me, I started digging further. After digging into the code I found

Driver.Manage().Window.Maximize();

.删除此行代码后,我可以使用上述解决方案在信息亭模式下打开Chrome.

being called after initialization of the driver. After removing this line of code, I was able to open Chrome in kiosk mode with the solution above.

这篇关于使用Selenium WebDriver,Chrome浏览器无法在信息亭模式下打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆