Good day to all! I\'ve been experiencing this problem for a week now but I don\'t think I can solve it and I also do not see any solution based on articles online. Hopefully
It would be tough to guess the exact reason of 100% CPU Usage without any visibility to your code blocks specifically the WebDriver configuration. So the answer will be pretty much based on generic guidelines as follows:
driver.quit()
within tearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully.
A couple of useful ChromeOptions()
and their usage are as follows:
options.addArguments("start-maximized"); // open Browser in maximized mode
options.addArguments("disable-infobars"); // disabling infobars
options.addArguments("--disable-extensions"); // disabling extensions
options.addArguments("--disable-gpu"); // applicable to windows os only
options.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems
options.addArguments("--no-sandbox"); // Bypass OS security model
Using hardcoded sleeps in the form of time.sleep(1)
is a big No.
@Test
.Have you tried releasing memory into the loop?
Maybe by picking up the values (list out of the loop?) and then resetting those variables to None
you can avoid excessive memory consumption.
...
while True:
...
close1 = close2 = close3 = close4 = close5 = close6 = None
...
You can also try forcing the garbage collector:
import gc
while True:
...
gc.collect()
If you think that the reason may be a script another another solution to detect the problem might be to enable Chrome to do remote debug and debug the page.
--remote-debugging-port=9222
I hope some of this helps you.