The approach of writing test cases for both Desktop and Mobile Web involves duplicating locators in different classes.To overcome this, we can use abstract page classes to handle initialization and differentiate between Web and Mobile views.Common locators and methods can be kept in the abstract page class, while specific ones are stored in their respective classes.From the test case class, communication should happen only through the abstract class to ensure seamless execution.