[英]Should we write separate page-object for the error pop-ups coming in a page?
Selenium Java Page-Object Model: Should we write separate page-object for the error pop-ups coming in a page? Selenium Java页面对象模型:我们应该为页面中出现的错误弹出窗口编写单独的页面对象吗? I am using the Page Object model and have each page as a single class and the actions in that page as methods. 我正在使用页面对象模型,并将每个页面作为一个单独的类,并将该页面中的操作作为方法。 Now, Should i include the pop-up handling on the same page as a method or should I have to create a separate page-object class for those pop-ups? 现在,我应该将弹出窗口处理与方法包含在同一页面上,还是应该为这些弹出窗口创建单独的页面对象类? What is the best practice.? 最佳做法是什么? Each pop-up has 2 options and some info about the pop-up to verify. 每个弹出窗口都有2个选项以及一些有关验证弹出窗口的信息。
Assuming all pop-ups have particular properties in common, you can create a separate class which would be included into each Page Object. 假设所有弹出窗口都有共同的特定属性,则可以创建一个单独的类,该类将包含在每个Page Object中。 If those description and option fields are always identified with same locators, it seems like a great idea. 如果这些描述和选项字段始终由相同的定位符标识,则似乎是个好主意。
In case those pop-ups differ in a way it is hard to handle them with single class you might consider creating an interface for pop-ups and have each of actual Page Object implement it and handle it on its own. 如果这些弹出窗口在单一类上难以处理的方式不同,则您可以考虑为弹出窗口创建一个接口,并让每个实际的Page Object实现并单独处理它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.