Selenium Tests Should Not Include Java/C# Statements

Photo by Jess @ Harper Sunday on Unsplash

I hear sometimes people saying that, in certain conditions, it is ok to use Java/C# statements in Selenium UI tests.

For example, the following UI test checks that all product titles include the search keyword:

public void All_Product_Titles_Include_Search_Keyword()
HomePage homePage = new HomePage(driver);