简体   繁体   English

如何在C#中获取特定chromedriver的PID-有多个实例

[英]How to get PID of the certain chromedriver in c# - there are multiple instances

Due to an annoying bug that exists in selenium : https://github.com/SeleniumHQ/selenium/issues/4054 由于硒中存在一个烦人的错误: https : //github.com/SeleniumHQ/selenium/issues/4054

I need to kill the chromdriver.exe manually. 我需要手动杀死chromdriver.exe。 However, i wonder that are there anyway i can get the PID of the existing chrome driver? 但是,我想知道是否还能获得现有chrome驱动程序的PID?

I am using windows 8.1 我正在使用Windows 8.1

Other components 其他组件

  • Selenium.Support 3.4.0 硒支持3.4.0
  • Selenium.WebDriver 3.4.0 Selenium.WebDriver 3.4.0
  • Selenium.WebDriver.ChromeDriver 2.29.0 Selenium.WebDriver.ChromeDriver 2.29.0
  • c# .net 4.6.2 c#.net 4.6.2
  • Microsoft Visual Studio Community 2017 RC Microsoft Visual Studio社区2017 RC

To clarify, there are multiple instances and i want to get only certain instance PID 为了澄清,有多个实例,我只想获取某些实例PID

i think u can use answer from this link Getting a pid of a process created in C# 我认为您可以使用此链接的答案获取在C#中创建的进程的pid

as it was stated where System.Diagnostics.Process.GetProcessesByName("chromdriver.exe")[0].Id 如前所述,System.Diagnostics.Process.GetProcessesByName(“ chromdriver.exe”)[0] .Id

will return PID number 将返回PID号

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM