How to Debug in Selenium IDE | Breakpoint & Start Point

Breakpoints are used to check the execution of your code. Whenever you implement a breakpoint in your code, the execution will stop right there. This helps you to verify that your code is working as expected. Breakpoints are usually shown in the UI along with the source code.

In this tutorial, you will learn-

Breakpoints in Selenium

Breakpoints in Selenium helps in debugging.

There are two methods to set breakpoints,

To demonstrate, let us consider the following scenario. Validate 'username' and 'password' when clicked on the 'Sign in' button.

Methods to implement breakpoints in Selenium

First Method:

Step 1) Launch Firefox and Selenium IDE.

Step 2) Type the Base URL as ---> http://newtours.demoaut.com/

Step 3) Click on the Record button (marked in the red box in the screenshot below).

Breakpoint & Start Point in Selenium IDE

Step 4) In this step,

  1. Under the tab "Table" right click on the command ( "clickandwait")
  2. Under the "Command" column select the 'Toggle Breakpoint'. You can also use the shortcut key "B" from the keyboard.

Breakpoint & Start Point in Selenium IDE

When you toggle breakpoint, it will open another window as shown below. You will see two yellow pipes mark, in front of "clickandwait", under 'Command' column.

Breakpoint & Start Point in Selenium IDE

It indicates two things,

Second Method:

Step 1) Follow the above steps 1, 2 & 3 mentioned in the First method.

Step 2) In this step,

  1. Click on option 'Actions' from Menu bar and
  2. Click on the option "Toggle Breakpoint".

Breakpoint & Start Point in Selenium IDE

This is all about the breakpoints in Selenium.

Start Point in Selenium

In Selenium, Start Point indicates the point from where the execution should begin. Start Point can be used when you want to run the testscript from the middle of the code or a breakpoint.

To understand this, let us take an example of the login scenario. Suppose, if you have to login into the website and perform series of tests and then try to debug one of those tests.

In this case, you have to login once and then re-run your tests as you are developing them. You can set the Start Points after login function. So everytime you perform a new test it will begin executing after the login function.

Start Point can be selected by two methods:

1. Right click on any command under the 'Command' column in selenium IDE. Select the option 'Set/clear Start Point '. You can also use the shortcut key 'S' from the keyboard to mark the start point (shown as a green triangle in the screen shot). Repeat the same step to deselect the Start Point .

2. Click "Actions" -> 'Set/Clear Start Point '. This will select the Start Point or repeat the same step to deselect them.

Methods to set Start Point in Selenium

Let see the first method with an example,

First Method:

Step 1) Launch Firefox and Selenium IDE.

Step 2) Type the Base URL as ---> http://newtours.demoaut.com/

Step 3) Click on the Record button (marked in red rectangle box in the the screen shot below).

Breakpoint & Start Point in Selenium IDE

Step 4) In this step,

  1. Under the tab "Table" right click on the command "clickandwait"
  2. Now select the option 'Set/Clear Start Point '. You can also use the short key "S" from the keyboard to select the same Set/Clear Start Point .

Breakpoint & Start Point in Selenium IDE

When you click on Set/ Clear Start Point, it will open another window. In this window, you can see the green Triangle symbol before "type" under 'Command' column.

This triangle symbol indicates that the test case starts at this point. So

when you click 'Run' button, the execution starts from that point onwards.

Breakpoint & Start Point in Selenium IDE

Note: There can only be one Start Point in a single test script. Also, Start Point is dependent on the currently displayed page. The execution will fail if the user is on the wrong page.

Second Method:

  1. Follow the above steps 1, 2 & 3 mentioned in previous (First) method.
  2. Next, follow the following steps,
  1. Click on option 'Actions' from Menu bar and
  2. Click on the option "Set/Clear Start Point ".

Breakpoint & Start Point in Selenium IDE

Summary

This article is contributed by Rupa Nallani

 

YOU MIGHT LIKE: