<legend id='0dc8h'><style id='0dc8h'><dir id='0dc8h'><q id='0dc8h'></q></dir></style></legend>
  1. <small id='0dc8h'></small><noframes id='0dc8h'>

        <bdo id='0dc8h'></bdo><ul id='0dc8h'></ul>
      <tfoot id='0dc8h'></tfoot>

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

      Webdriver - 如何检查浏览器是否仍然存在或仍然打开?

      Webdriver - How to check if browser still exists or still open?(Webdriver - 如何检查浏览器是否仍然存在或仍然打开?)
      • <bdo id='AH9kV'></bdo><ul id='AH9kV'></ul>

        <legend id='AH9kV'><style id='AH9kV'><dir id='AH9kV'><q id='AH9kV'></q></dir></style></legend>
          <tfoot id='AH9kV'></tfoot>
          <i id='AH9kV'><tr id='AH9kV'><dt id='AH9kV'><q id='AH9kV'><span id='AH9kV'><b id='AH9kV'><form id='AH9kV'><ins id='AH9kV'></ins><ul id='AH9kV'></ul><sub id='AH9kV'></sub></form><legend id='AH9kV'></legend><bdo id='AH9kV'><pre id='AH9kV'><center id='AH9kV'></center></pre></bdo></b><th id='AH9kV'></th></span></q></dt></tr></i><div id='AH9kV'><tfoot id='AH9kV'></tfoot><dl id='AH9kV'><fieldset id='AH9kV'></fieldset></dl></div>
              <tbody id='AH9kV'></tbody>
          • <small id='AH9kV'></small><noframes id='AH9kV'>

                本文介绍了Webdriver - 如何检查浏览器是否仍然存在或仍然打开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我想检查浏览器是否仍然存在,如果不存在,那么我想打开一个新的浏览器!webdriver中是否有可用的api来检查浏览器是否仍然存在?

                I want to check if browser still exists and if it isn't then i want to open a new browser! Is there a api available in webdriver to check if the browser still exists?

                推荐答案

                调用driver.close()后驱动的值被设置为

                After calling driver.close() the value of driver is set to

                FirefoxDriver: firefox on WINDOWS(4b4ffb1e-7c02-4d9c-b37b-310c771492ac)
                

                但是如果你调用 driver.quit() 那么它会将 driver 的值设置为

                But if you call driver.quit() then it sets the value of driver to

                FirefoxDriver: firefox on WINDOWS (null)
                

                因此,如果您在调用 driver.quit() 后检查浏览器窗口,那么您将能够通过以下实现知道.

                So if you're checking the browser window after calling driver.quit() then you will be able to know by below implementation.

                WebDriver driver = new FirefoxDriver();
                driver.get("http://www.google.com");
                driver.quit();              
                if(driver.toString().contains("null"))
                {
                
                System.out.print("All Browser windows are closed ");
                }
                else
                {
                //open a new Browser
                }
                

                这篇关于Webdriver - 如何检查浏览器是否仍然存在或仍然打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)
                <tfoot id='BwAat'></tfoot>

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

                        <tbody id='BwAat'></tbody>
                      <legend id='BwAat'><style id='BwAat'><dir id='BwAat'><q id='BwAat'></q></dir></style></legend>
                      • <small id='BwAat'></small><noframes id='BwAat'>

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