O'Reilly logo

Selenium WebDriver Recipes in C#, Second Edition by Zhimin Zhan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 14

image

Debugging Test Scripts

Debugging usually means analyzing and removing bugs in the code. In the context of automated functional testing, debugging is to find out why a test step did not execute as expected and fix 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 that test from the command line:

Now on page: Assertion Test PageApplication number is 1234

When the test is executed in a continuous integration server, output is normally captured and shown. This can be ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required