WebDriver if-else Branching and JavaScript

There is no step branching available for WebDriver monitor. This means that you cannot be executing the Selenium commands conditionally. You need to employ
command to make loops or if-else branching possible. Since the JavaScript snippets in
command is running in the context of the page they’re executed on, you can take advantage of all and any JavaScript libraries loaded within the page.
Do not to let your
code throw uncaught exceptions as that would interrupt the WebDriver script run with “Javascript thrown an exception” error message. A best practice is to wrap your code with
block, possibly using
function to log the exception. This way the monitor run would not be interrupted and you’d see the console messages in the check details view.