From e9483b0c5f7e23a40b8b1906f2b9f138cb33e417 Mon Sep 17 00:00:00 2001 From: Alexis Deprez Date: Fri, 4 Oct 2024 13:15:47 +0200 Subject: [PATCH] fix: allow element xpath selection without filter --- .../lavague-drivers-selenium/lavague/drivers/selenium/node.py | 3 +++ lavague-sdk/lavague/sdk/base_driver/javascript.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lavague-integrations/drivers/lavague-drivers-selenium/lavague/drivers/selenium/node.py b/lavague-integrations/drivers/lavague-drivers-selenium/lavague/drivers/selenium/node.py index c79d2d36..fae9f701 100644 --- a/lavague-integrations/drivers/lavague-drivers-selenium/lavague/drivers/selenium/node.py +++ b/lavague-integrations/drivers/lavague-drivers-selenium/lavague/drivers/selenium/node.py @@ -150,6 +150,9 @@ def find_element(xpath): self._element = find_element(local_xpath) + if not self._element: + raise ElementNotFoundException(self.xpath) + def exit_context(self): if hasattr(self, "_element"): self.driver.switch_to.default_content() diff --git a/lavague-sdk/lavague/sdk/base_driver/javascript.py b/lavague-sdk/lavague/sdk/base_driver/javascript.py index 79b1a39d..a009300f 100644 --- a/lavague-sdk/lavague/sdk/base_driver/javascript.py +++ b/lavague-sdk/lavague/sdk/base_driver/javascript.py @@ -79,7 +79,7 @@ def js_wrap_function_call(fn: str): && (e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth)) { evts.push('SCROLL'); } - if (filterTypes && evts.length) { + if (filterTypes && filterTypes.length) { evts = evts.filter(t => filterTypes.includes(t)); } if (nonInteractives && evts.length === 0) {