From c687f40c206e1d1f874e91dd396c8d68c64c83f2 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Wed, 11 Nov 2020 01:11:01 +0300 Subject: refactor: move click handlers to utils --- src/utils.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/utils.js (limited to 'src/utils.js') diff --git a/src/utils.js b/src/utils.js new file mode 100644 index 0000000..cf9fe38 --- /dev/null +++ b/src/utils.js @@ -0,0 +1,13 @@ +const clickElementByXPath = (page, xPath) => page + .waitForXPath(xPath) + .then(item => item.click()); + +const clickElementBySelector = (page, selector) => page + .waitForSelector(selector) + .then(item => item.click()); + + +module.exports = { + clickElementByXPath, + clickElementBySelector +}; -- cgit v1.2.3