I want to test a front end vanilla javascript using Selenium in java. I can easily open the page click on some stuff etc, but I couldn't figure out exactly what is the best practices to assert tests. Mainly, can we get the variables after clicking on some buttons, for example let's say:
function button(){
variable = 2;
}
Let's say some button calls the function above, in selenium I can click on the function but is there a way to call the variable and do something like;
AssertEquals(2, driver.getVariableFromJavascriptAfterClick())
If not, how should I test something like that.
Thanks