diff --git a/lute/templates/book/tablelisting.html b/lute/templates/book/tablelisting.html
index c38e6fc8..7d2035ae 100644
--- a/lute/templates/book/tablelisting.html
+++ b/lute/templates/book/tablelisting.html
@@ -326,4 +326,6 @@
function clear_datatable_state() {
book_listing_table.state.clear();
}
+
+ window.clear_datatable_state = clear_datatable_state;
diff --git a/tests/acceptance/lute_test_client.py b/tests/acceptance/lute_test_client.py
index 1adc2b2b..f020553c 100644
--- a/tests/acceptance/lute_test_client.py
+++ b/tests/acceptance/lute_test_client.py
@@ -18,6 +18,7 @@
import requests
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
+from selenium.webdriver.support.ui import WebDriverWait
class LuteTestClient: # pylint: disable=too-many-public-methods
@@ -71,6 +72,8 @@ def index(self):
def clear_book_filter(self):
"Clear all state. Normally state is saved."
+ s = "return typeof clear_datatable_state === 'function';"
+ WebDriverWait(self.browser, 10).until(lambda driver: driver.execute_script(s))
self.browser.execute_script("clear_datatable_state()")
time.sleep(0.1)