Listen to this blog
However, with the script pinning feature, you can store & run the commonly used snippets using the WebDriver session instead of storing in String variables.
You can also unpin the store script anytime.
If you would like to store and retrieve multiple pins, you can use Set to save the pins.
Set<ScriptKey> expected = ImmutableSet.of( executor.pin("return arguments;"), executor.pin("return 'cheese';"), executor.pin("return 42;")); Set<ScriptKey> pinned = executor.getPinnedScripts();