Start Points and Breakpoints in Selenium

Breakpoints in Selenium are used to stall the execution of test. The execution will stop whenever a breakpoint is implemented and this will help to check whether the code is working properly and as expected. The breakpoints in Selenium will be displayed in the UI along with the source code.

Breakpoints in Selenium help in debugging and there are two different methods to set breakpoints.

First Method

  • Select “Toggle Breakpoint” after right clicking on the command. You can also the shortcut key “B” from the keyboard for selecting Toggle Breakpoint.
  • Now, a breakpoint can be set just before the test case you need to examine.
  • Now, click on the “Run” button to run the test case from the starting point to the breakpoint.
  • Same step should be repeated for deselecting the breakpoint.

Second Method

  • Select “Actions” from the menu bar and then select “Toggle Breakpoint”. Same step can be taken to deselect the breakpoint.

Methods to implement breakpoints in Selenium

The first method to implement breakpoints in Selenium is as follows. Here, we are going to validate username and password when clicked on the “Sign in” button.

  • Launch Firefox and Selenium IDE
  • Type the base URL
  • Click on the record button
  • Right click on the command “clickandwait” under the tab “Table”
  • Select the “Toggle Breakpoint” under the “Command” column. Shortcut key “B” also can be used for this.
  • A new window will open when you toggle breakpoint and two yellow pipe marks will appear before “Clickandwait” in the command column. The yellow pipe shows that the test has been paused at this point. When the “Run” button is clicked the test case will run from the beginning to this point. Multiple breakpoints can be created in a test.

The steps in the second method is given below.

  • Follow the first three steps as in the first method.
  • Go to the menu bar, click on the “Action” and then on the “Toggle Breakpoint”

Start Point in Selenium

Start point in Selenium denotes the point from where the execution should be started. It can be used to run the script from the middle of the code or at breakpoint. Let us explain it with an example. Assume that you have to login to a website and to perform a series of tests there and then to debug one of those tests. Here you need to login only once and can re-run the tests. Here, you can set the start point after the login function. Hence, every new test you perform will start only after the login function.

There are two different methods to select start point in Selenium

First Method

  • Launch Firefox and Selenium IDE
  • Type the base URL
  • Click on the record button
  • Right click on the command “clickandwait” under the tab “Table”
  • Select the option “Set/ Clear Start point” You can do it by pressing shortcut key “S” from the keyboard.
  • A new window will get opened and a green triangle shaped symbol will be seen in the “Command” column before “Type”.
  • This indicates the start point in Selenium and the test will start running from this point when you click on “Run” button. Unlike the breakpoints, multiple start points cannot be created and only one start point will be there in one test script.

Second Method

  • Follow the first three steps in the first method
  • Go to Menu Bar and click on the option “Action”
  • Click on the option “Set/ Clear Start point”

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *