How to validate datalayer that i've pulled from the chrome console

Viewed 39

I am using the following code to get data layer, help me how to validate the data layer. Is there any way to validate the data layer? I declared two list actual_values and Notexist and how do i make use of them in validation? The below code pulls datalayer from this site here i need to validate event,country,beverage,language from the datalayer

List<String>actual_values=new ArrayList <String>();
List<String>Notexist=new ArrayList <String>();
JavascriptExecutor executor = (JavascriptExecutor)driver;
List<String> datalist = new ArrayList<String>();
datalist =  (List<String>) executor.executeScript("return window.dataLayer");
System.out.println(datalist);
0 Answers
Related