I\'m using selenium to do some stuff that involves loading quite a number of pages, potentially with numerous images and/or flash ads, which is apparently rather stressful on th
The best strategy I came up with was to just terminate processes that have been running longer than a set threshold (e.g. orphaned processes). This snippet can be called via child_process.execFile('powershell.exe')
. Found this useful for chromedriver
and webdriverJS when the browser hangs because of misbehaving javascript.
# View Processes Running > 30 MIN
Get-Process -name firefox | ? { $_.StartTime -lt (Get-Date).AddMinutes(-30) } | select pid, starttime | Sort-Object starttime
# Terminate Processes Running > 30 MIN
Get-Process -name firefox | ? { $_.StartTime -lt (Get-Date).AddMinutes(-30) } | Stop-Process -Force