so I am creating a automation to detect if a GTM(dataLayer) is exist or not
but the problem is there is a GTM that emerge when I click login, then, the page get directed to another page immediately. so I don’t get the chance to get the dataLayer (the GTM I am looking just disappear immediately when the page get redirect to another page)
I tried using promise with javascript in katalon it failed. and tried using javascript eventListener but also failed.
can someone help me giving an idea how to solve this problem
Here how I get GTM(dataLayer)
WebUI.executeJavaScript('return dataLayer;', [])
the javascript I tried (but failed)
WebUI.executeJavaScript("document.getElementById('login-step-two-form').addEventListener('click', function(){'return dataLayer' })", Arrays.asList(data))