久久久久久久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,因此我可以執行以下操作: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模板網!

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

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  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>
                            主站蜘蛛池模板: 中文字幕视频在线观看 | 日韩电影免费观看中文字幕 | 9久久精品| 美日韩免费 | 日本精品一区二区在线观看 | 日本欧美在线观看视频 | 亚洲一区二区三区四区五区午夜 | 日本大香伊一区二区三区 | 亚洲精品视频三区 | 亚洲 欧美 综合 | 亚洲国产精品成人 | 欧美日韩a| 欧美日韩手机在线观看 | 欧美精品一区二区三区在线 | 91亚洲国产成人久久精品网站 | 中文久久 | 欧美日韩精品在线一区 | 久久久精品亚洲 | 福利视频一区二区 | 日韩久久成人 | 久久毛片 | 一区二区久久 | 色婷婷激情综合 | 久久国产精品久久 | 精品乱码一区二区三四区视频 | 亚洲 中文 欧美 日韩 在线观看 | 久久久久久久一区 | 一区在线视频 | 91 视频网站| 日韩1区2区| 久久精品中文字幕 | 日日夜精品视频 | 超碰网址 | 啪一啪在线视频 | 91久久综合亚洲鲁鲁五月天 | av免费网站在线 | 欧美激情一区二区三级高清视频 | 久久大陆 | 国产精品一区二区av | 国产99久久精品 | 久久久男人的天堂 |