【问题标题】:Hide Navigation Bar in Firefox using Selenium C#使用 Selenium C# 在 Firefox 中隐藏导航栏
【发布时间】:2020-11-09 07:26:38
【问题描述】:

我正在使用 Selenium 来自动化一些活动。我的代码是

FirefoxOptions options = new FirefoxOptions();
options.AddArguments("--disable-infobars");
FirefoxDriver driver = new FirefoxDriver(firefoxDriverService, options);
driver.Navigate().GoToUrl("https://www.google.com");

这会打开 Firefox 并将我导航到 Google。但我想打开隐藏导航栏的Firefox。提前致谢。

【问题讨论】:

    标签: c# selenium firefox


    【解决方案1】:

    全屏相当于在浏览器上按 F11 并移除导航栏。

    driver.Manage().Window.FullScreen();
    

    [更新 1] - 似乎只适用于 chrome,但如果你不想要标题栏试试这个:

    options.AddArguments("--app=https://google.co.uk");
    

    [更新 2] - 与上述不同,对于 Firefox 和 chrome,请尝试 kiosk 模式:

    options.AddArguments("--Kiosk=https://www.google.co.uk");
    

    Firefox 命令行选项可用here

    【讨论】:

    • 是的。但是一旦鼠标触摸顶部,它就会再次出现。可以永久隐藏吗?
    • 我已经看到了。看看我能不能找到标签然后我更新答案
    • 已更新 - 它仅适用于 chrome,我会看看是否能找到与 firefox 相同的标签...
    猜你喜欢
    • 1970-01-01
    • 2014-06-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多