Issue
Is it possible to throttle CPU in chrome's devtools via python selenium? And if so, how?
It would appear the driver has a method execute_cdp_cmd
which stands for "Execute Chrome Devtools Protocol command" but I do not know what command I would give it.
Solution
It would appear to be possible in chromedriver 75.
## rate 1 is no throttle, 2 is 2x slower, etc.
driver.execute_cdp_cmd("Emulation.setCPUThrottlingRate", {'rate': 10})
NOTE:
2.38 didn't seem to support execute_cdp_cmd()
while 2.48 did. Chromedriver also appears to have changed their versioning scheme to keep in sync with browser releases.
I did some quick checking and was able to push the throttle rate to upwards of 200x but it started having serious issues. My guess it going beyond 100x is ill-advised.
Answered By - Marcel Wilson
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.