Chromedriver Devtools port number error
Had the same problem, I had to upgrade Chrome to the latest release and it fixed it.
WebDriverException: Message: unknown error: Could not remove old devtools port file error updating the Selenium Options() within a function
This error message...
selenium.common.exceptions.WebDriverException: Message: unknown error: Could not remove old devtools port file. Perhaps the given user-data-dir at "C:\Users\ResetStoreX\AppData\Local\Google\Chrome\User Data" is still attached to a running Chrome or Chromium process
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session for either of the following reasons:
- There are previous instance of ChromeDriver process attached to the system memory.
- You have a manually opened google-chrome session already running.
Because as per RemoveOldDevToolsActivePortFile():
Status RemoveOldDevToolsActivePortFile(const base::FilePath& user_data_dir) {
base::FilePath port_filepath = user_data_dir.Append(kDevToolsActivePort);
// Note that calling DeleteFile on a path that doesn't exist returns True.
if (base::DeleteFile(port_filepath)) {
return Status(kOk);
}
return Status(
kUnknownError,
base::StringPrintf(
"Could not remove old devtools port file. Perhaps the given "
"user-data-dir at %s is still attached to a running %s or "
"Chromium process",
user_data_dir.AsUTF8Unsafe().c_str(), kBrowserShortName));
}
References
You can find a couple of relevant detailed discussions in:
- chromedriver.exe runs ~8 chrome.exe instances
- Many process of Google Chrome (32 bit)
Chrome Driver - no longer able to use DevTools api of a web driver session opened by selenium
You no longer need to use chrome-remote-interface to access the chrome debugging port. You can now use Selenium 4's new ChromeDriver dev tools SDK to execute commands against chrome through the CDP.
Switching to this fixed the problem.
WebDriverException: Message: unknown error: DevTools returned unknown type:service_worker
This looks most probably like a ChromeDriver Issue
.
You can try with downloading the latest Chrome WebDriver here
for you Platform or operating system.
It should work.
Related Topics
Update Field Through Link_To in Rails
Ruby: Module, Mixins and Blocks Confusing
Delayed_Job: Job Failed to Load: Uninitialized Constant Syck::Syck
Ruby: Length of a Line of a File in Bytes
Display Result Data Without Page Refresh on Form Submission in Ruby on Rails
Rails: Merit Gem Badge Not Registering or Displaying
Uri::Invalidurierror: Bad Uri(Is Not Uri) Testing Rails Controllers
Where Are Catch and Throw Useful in Ruby
Why Is Ruby's Loop Command Slower Than While True
What Does "String Literal in Condition" Mean
How to Fix in Ruby on Rails the Undefined Method 'Alias_Method_Chain' Error
How to Make Empty Tags Self-Closing with Nokogiri
How to Test Order-Conscious Equality of Hashes
Gem Install Debugger -V '1.5.0' Fails
Ruby Tcpserver to Get Client Ip Address