I was searching over INTERNET, i didn't find solution for this coding puzzle, let say we have listView and each option will return different screens object. Now I need to create a method that on click on different option based on if/else condtion should return different screens class object. I tried and explored on this coding puzzle, how achieve this, by extending each of may page by using BaseClass or by implementing some interface. in Method, we call return as BaseClass or interface.
possible explanation came as Object orient coding, we can't achieve this. Even if we use BaseClass or interface, than also we can't call sub class or implemented class object
Object will called here will Super class object or Interface object, so Base class or Interface are called here
So, In TestNG or any testcases running using Page Object Model, will not allow us to call instance of those if/else class. We terminate coding statement and Create new Class Object(as per requirement of if/else).
Still, if someone have Idea how to continue calling those methods on listview, without terminating those statement.