From 8b10587031f983b107807b6ed016de60018324da Mon Sep 17 00:00:00 2001 From: Vangelis Banos Date: Tue, 4 Aug 2020 06:27:21 +0000 Subject: [PATCH] Skip loading behavior when behavior_timeout=0 The user may set `behavior_timeout=0`. This means that they don't want to run the behavior. As it is now, Brozzler will invoke `brozzler.behavior_script` to load the script and `self.run_behavior` to execute it. We will run the behavior using `Runtime.evaluate` but then it will be terminated immediately because of timeout=0. It is better to skip behavior loading and running when `behavior_timeout=0`. --- brozzler/browser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brozzler/browser.py b/brozzler/browser.py index 34d3eec..e0f1f06 100644 --- a/brozzler/browser.py +++ b/brozzler/browser.py @@ -509,7 +509,7 @@ class Browser: self.websock_thread.page_status >= 400): run_behaviors = False - if run_behaviors: + if run_behaviors and behavior_timeout > 0: behavior_script = brozzler.behavior_script( page_url, behavior_parameters, behaviors_dir=behaviors_dir)