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`.
This commit is contained in:
Vangelis Banos 2020-08-04 06:27:21 +00:00
parent dc0d99470a
commit 8b10587031

View File

@ -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)