I use the executeScript method in the selenium web driver, I found a problem:
js.executeScript("var b='1'; "); js.executeScript("alert(b)");
After running on the code, I expect to get a warning window with a value of 1 , but it says:
b is not defined
My question is: I defined b as a global variable, but why can't I get it later?
source share