久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <i id='IJ8P2'><tr id='IJ8P2'><dt id='IJ8P2'><q id='IJ8P2'><span id='IJ8P2'><b id='IJ8P2'><form id='IJ8P2'><ins id='IJ8P2'></ins><ul id='IJ8P2'></ul><sub id='IJ8P2'></sub></form><legend id='IJ8P2'></legend><bdo id='IJ8P2'><pre id='IJ8P2'><center id='IJ8P2'></center></pre></bdo></b><th id='IJ8P2'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='IJ8P2'><tfoot id='IJ8P2'></tfoot><dl id='IJ8P2'><fieldset id='IJ8P2'></fieldset></dl></div>
    <legend id='IJ8P2'><style id='IJ8P2'><dir id='IJ8P2'><q id='IJ8P2'></q></dir></style></legend>
    1. <small id='IJ8P2'></small><noframes id='IJ8P2'>

      • <bdo id='IJ8P2'></bdo><ul id='IJ8P2'></ul>

    2. <tfoot id='IJ8P2'></tfoot>

        如何使用 Java 獲取 chromedriver 進程 PID?

        How can I get chromedriver process PID using Java?(如何使用 Java 獲取 chromedriver 進程 PID?)

            <tbody id='YofPJ'></tbody>

          <tfoot id='YofPJ'></tfoot>

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

            <bdo id='YofPJ'></bdo><ul id='YofPJ'></ul>
              1. <legend id='YofPJ'><style id='YofPJ'><dir id='YofPJ'><q id='YofPJ'></q></dir></style></legend>
                • <i id='YofPJ'><tr id='YofPJ'><dt id='YofPJ'><q id='YofPJ'><span id='YofPJ'><b id='YofPJ'><form id='YofPJ'><ins id='YofPJ'></ins><ul id='YofPJ'></ul><sub id='YofPJ'></sub></form><legend id='YofPJ'></legend><bdo id='YofPJ'><pre id='YofPJ'><center id='YofPJ'></center></pre></bdo></b><th id='YofPJ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='YofPJ'><tfoot id='YofPJ'></tfoot><dl id='YofPJ'><fieldset id='YofPJ'></fieldset></dl></div>
                  本文介紹了如何使用 Java 獲取 chromedriver 進程 PID?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我遇到了一個問題.有時,當我的 JUnit 測試運行時,命令 webDriver.quit();沒有殺死 chromedriver 進程,因此下一個測試無法開始.在這種情況下,我想添加一些可能會在 Linux 上手動終止進程的方法,但我不知道如何獲取 chromedriver 的 PID,因此我可以執(zhí)行以下操作:Runtime.getRuntime().exec(KILL + PID);

                  I've faced a problem. Sometimes, while my JUnit tests are running, command webDriver.quit(); isn't killing chromedriver process so the next test can't start. In that case I want to add some method which may kill process manually on Linux, but I can't figure out how to get PID of chromedriver so I can do something like: Runtime.getRuntime().exec(KILL + PID);

                  推薦答案

                  你可以使用 pgrep 找到 PID,然后殺死它:

                  You can find PIDs using pgrep and then kill it:

                      private void killChromedriver() throws IOException, InterruptedException {
                          String command = "pgrep chromedriver";
                          Process process = Runtime.getRuntime().exec(command);
                          BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
                          List<String> processIds = getProcessedIds (process, br);
                          for (String pid: processIds) {
                                  Process p = Runtime.getRuntime().exec("kill -9 " + pid);
                                  p.waitFor();
                                  p.destroy();
                          }
                      }
                      private List<String> getProcessedIds(Process process, BufferedReader br) throws IOException, InterruptedException {
                          process.waitFor();
                  
                          List<String> result = new ArrayList<>();
                          String processId ;
                  
                          while (null != (processId = br.readLine())) {
                              result.add(processId);
                          }
                  
                          process.destroy();
                          return result;
                      }
                  

                  <小時>

                  更新

                  另一個更簡單的解決方案似乎是

                  Another and more simple solution seems to be

                      Runtime.getRuntime().exec("pkill chromedriver");
                  

                  這篇關于如何使用 Java 獲取 chromedriver 進程 PID?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯(lián)網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數(shù)溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數(shù)轉換為整數(shù)?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創(chuàng)建一個隨機打亂數(shù)字的 int 數(shù)組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 0xff000000 存儲為 int?)
                • <legend id='0Ay0r'><style id='0Ay0r'><dir id='0Ay0r'><q id='0Ay0r'></q></dir></style></legend>

                    <tbody id='0Ay0r'></tbody>

                      • <bdo id='0Ay0r'></bdo><ul id='0Ay0r'></ul>

                        <tfoot id='0Ay0r'></tfoot>

                        <small id='0Ay0r'></small><noframes id='0Ay0r'>

                            <i id='0Ay0r'><tr id='0Ay0r'><dt id='0Ay0r'><q id='0Ay0r'><span id='0Ay0r'><b id='0Ay0r'><form id='0Ay0r'><ins id='0Ay0r'></ins><ul id='0Ay0r'></ul><sub id='0Ay0r'></sub></form><legend id='0Ay0r'></legend><bdo id='0Ay0r'><pre id='0Ay0r'><center id='0Ay0r'></center></pre></bdo></b><th id='0Ay0r'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0Ay0r'><tfoot id='0Ay0r'></tfoot><dl id='0Ay0r'><fieldset id='0Ay0r'></fieldset></dl></div>
                            主站蜘蛛池模板: 一区二区三区视频免费看 | 男人的天堂久久 | 日韩精品一区二区久久 | 免费一级毛片 | 亚洲一区二区三区四区视频 | h视频免费看 | 国产福利91精品一区二区三区 | 国产91久久久久蜜臀青青天草二 | 欧美精品一区二区三区在线播放 | 一级免费看片 | 久久久精品久久 | 欧美视频第二页 | 午夜视频网站 | 一级毛片免费视频观看 | 免费看片国产 | 欧美一区二区三区大片 | 久久精品久久久 | 黄网站免费入口 | 中文字幕在线观看一区二区 | 天天干天天草 | www久久| 第一区在线观看免费国语入口 | 色片在线观看 | 国产精品高潮呻吟久久久久 | 久久网站免费视频 | 成人欧美一区二区三区在线播放 | 日日操夜夜操视频 | 日韩精品在线观看一区二区 | 久久成人综合 | 中文字幕成人av | 欧美成人h版在线观看 | 在线成人av | 中文字幕一区二区三区乱码在线 | 亚洲伦理自拍 | 亚洲精品久久久一区二区三区 | 免费三级av | 国产网站在线播放 | 精品一区二区电影 | 国产一区二区三区精品久久久 | 久草综合在线 | 免费人成在线观看网站 |