© Courtney Zhan, Edited by Zhimin Zhan 2024
Z. Zhan (ed.)Selenium WebDriver Recipes in C#https://doi.org/10.1007/979-8-8688-0023-8_14

14. Debugging Test Scripts

Courtney Zhan1  
(1)
Fitzgibbon, QLD, Australia
 

Debugging usually means analyzing and removing bugs in the code. In the context of automated functional testing, debugging means finding out why a test step did not execute as expected and then fixing it.

Print Text for Debugging

Console.WriteLine("Now on page: " + driver.Title);
String app_no = driver.FindElement(By.Id("app_id")).Text;
Console.WriteLine("Application number is " + app_no);
Here is the output from executing the above test from command line:
Now on page: Assertion Test Page
Application number is 1234

When the test is executed in a Continuous ...

Get Selenium WebDriver Recipes in C#: Practical Testing Solutions for Selenium WebDriver now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.