1. <i id='X5vRo'><tr id='X5vRo'><dt id='X5vRo'><q id='X5vRo'><span id='X5vRo'><b id='X5vRo'><form id='X5vRo'><ins id='X5vRo'></ins><ul id='X5vRo'></ul><sub id='X5vRo'></sub></form><legend id='X5vRo'></legend><bdo id='X5vRo'><pre id='X5vRo'><center id='X5vRo'></center></pre></bdo></b><th id='X5vRo'></th></span></q></dt></tr></i><div id='X5vRo'><tfoot id='X5vRo'></tfoot><dl id='X5vRo'><fieldset id='X5vRo'></fieldset></dl></div>
      • <bdo id='X5vRo'></bdo><ul id='X5vRo'></ul>

      <legend id='X5vRo'><style id='X5vRo'><dir id='X5vRo'><q id='X5vRo'></q></dir></style></legend>

      <small id='X5vRo'></small><noframes id='X5vRo'>

        <tfoot id='X5vRo'></tfoot>
      1. 如何隐藏 Firefox 窗口(Selenium WebDriver)?

        How to hide Firefox window (Selenium WebDriver)?(如何隐藏 Firefox 窗口(Selenium WebDriver)?)

        <tfoot id='a4dRj'></tfoot>

            <small id='a4dRj'></small><noframes id='a4dRj'>

              <bdo id='a4dRj'></bdo><ul id='a4dRj'></ul>

                    <tbody id='a4dRj'></tbody>
                  <i id='a4dRj'><tr id='a4dRj'><dt id='a4dRj'><q id='a4dRj'><span id='a4dRj'><b id='a4dRj'><form id='a4dRj'><ins id='a4dRj'></ins><ul id='a4dRj'></ul><sub id='a4dRj'></sub></form><legend id='a4dRj'></legend><bdo id='a4dRj'><pre id='a4dRj'><center id='a4dRj'></center></pre></bdo></b><th id='a4dRj'></th></span></q></dt></tr></i><div id='a4dRj'><tfoot id='a4dRj'></tfoot><dl id='a4dRj'><fieldset id='a4dRj'></fieldset></dl></div>
                • <legend id='a4dRj'><style id='a4dRj'><dir id='a4dRj'><q id='a4dRj'></q></dir></style></legend>
                  本文介绍了如何隐藏 Firefox 窗口(Selenium WebDriver)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当我同时执行多个测试时,我不想让 Firefox 浏览器窗口保持可见.我可以使用 selenium.minimizeWindow() 将其最小化,但我不想这样做.

                  When I execute multiple test simultaneously, i don't want to keep Firefox browser window visible.. I can minimize it using selenium.minimizeWindow() but I don't want to do it.

                  有什么方法可以隐藏 Firefox 窗口吗?我正在使用 FireFox WebDriver.

                  Is there any way to hide Firefox window? I am using FireFox WebDriver.

                  推荐答案

                  最后我找到了解决方案,适用于那些使用 windows Machine 使用任何方法运行测试的人.好吧,实现不是在 Java 中,但你可以很容易地做到这一点.

                  Finally I found the solution for those who are using windows Machine for running the Tests using any method. Well, implementation is not in Java, but you can do it very easily.

                  使用 AutoIt 工具.它具有处理窗口的所有能力.它是一个免费工具.

                  Use AutoIt tool. It has all the capability to handle windows. It is a free tool.

                  1. 安装 AutoIt:http://www.autoitscript.com/site/autoit/downloads/

                  打开编辑器并编写以下代码用于隐藏任何窗口.

                  Open the Editor and write below code for Hiding any window.

                  AutoItSetOption("WinTitleMatchMode", 2)
                  WinSetState("Title Of Your Window", "", @SW_HIDE) 
                  

                • 要取消隐藏,可以使用下面的代码.

                • To Unhide it, you can use below line of code.

                  AutoItSetOption("WinTitleMatchMode", 2)
                  WinSetState("Title Of Your Window", "", @SW_SHOW)
                  

                  WinTitleMatchMode 有不同的选项可用于匹配 Windows 标题.

                  WinTitleMatchMode has different options which can be used to match Windows title.

                  1 = Match the title from the start (default)`
                  2 = Match any substring in the title
                  3 = Exact title match
                  4 = Advanced mode, see Window Titles & Text (Advanced)
                  

                • 所以,我所做的是:我创建了一个小程序的 .exe 文件,并将参数作为命令行参数传递,如下所示.

                  So, what I've done is: I have created an .exe file of a small program and passed a parameter as a command line argument as below.

                  Runtime.getRuntime().exec("C:/Diiinnovation/HideNSeek.exe 0 "" + "Mozilla Firefox" + """);
                  

                  HideNSeek.exe - 我有下面的 AutoIt 代码:

                  in HideNSeek.exe - I have below AutoIt Code:

                  AutoItSetOption("WinTitleMatchMode", 1) 
                  
                  if $CmdLine[0] > 0 Then
                      if $CmdLine[1] == 0 Then
                          WinSetState($CmdLine[2], "", @SW_HIDE)    
                      ElseIf $CmdLine[1] == 1 Then
                          WinSetState($CmdLine[2], "", @SW_SHOW)          
                      Else    
                      EndIf   
                  EndIf
                  

                  $CmdLine[] 是一个数组,它将包含所有命令行参数...

                  $CmdLine[] is an array, which will have all command line parameters...

                  $CmdLine[0] = number of Parameter
                  $CmdLine[1] = 1st Parameter after Exe Name 
                  ...
                  

                  如果窗口标题中有空格,则必须使用双引号将其作为命令行参数传递,如上.

                  If there is any space in the Window Title, then you have to use double quotes to pass it as a command line parameter like above.

                  下面的代码行将执行 AutoIt exe,如果我在第一个参数中传递 '0' 那么它将隐藏窗口,如果我将传递 '1' 然后它将取消隐藏与标题匹配的窗口.

                  Below Line of code will execute AutoIt exe and if I pass '0' in 1st parameter then it will hide the window and if I will pass '1' then it will unhide windows matching the title.

                  Runtime.getRuntime().exec("C:/Diiinnovation/HideNSeek.exe 0 "" + "Mozilla Firefox" + """);
                  

                  我希望这会对你有所帮助.谢谢!

                  I hope this will help you. Thanks!

                  这篇关于如何隐藏 Firefox 窗口(Selenium WebDriver)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  env: python: No such file or directory(env: python: 没有这样的文件或目录)
                  How to evaluate environment variables into a string in Python?(如何在 Python 中将环境变量评估为字符串?)
                  Python - temporarily modify the current process#39;s environment(Python - 临时修改当前进程的环境)
                  Change current process environment#39;s LD_LIBRARY_PATH(更改当前进程环境的 LD_LIBRARY_PATH)
                  Reading and writing environment variables in Python?(在 Python 中读写环境变量?)
                  When to use sys.path.append and when modifying %PYTHONPATH% is enough(何时使用 sys.path.append 以及何时修改 %PYTHONPATH% 就足够了)
                      • <bdo id='3B13T'></bdo><ul id='3B13T'></ul>
                        <i id='3B13T'><tr id='3B13T'><dt id='3B13T'><q id='3B13T'><span id='3B13T'><b id='3B13T'><form id='3B13T'><ins id='3B13T'></ins><ul id='3B13T'></ul><sub id='3B13T'></sub></form><legend id='3B13T'></legend><bdo id='3B13T'><pre id='3B13T'><center id='3B13T'></center></pre></bdo></b><th id='3B13T'></th></span></q></dt></tr></i><div id='3B13T'><tfoot id='3B13T'></tfoot><dl id='3B13T'><fieldset id='3B13T'></fieldset></dl></div>
                        <tfoot id='3B13T'></tfoot>
                          <tbody id='3B13T'></tbody>

                        <legend id='3B13T'><style id='3B13T'><dir id='3B13T'><q id='3B13T'></q></dir></style></legend>

                        <small id='3B13T'></small><noframes id='3B13T'>