1. 页面对象模型(POM):
Page 的对象是一个 OOPs 类,它充当被测应用程序网页的接口,它实际上是一种通常在Selenium用于测试用例自动化的设计模式。此 POM 中的页面类结合了 Web 因素和技术来与 Web 元素互动。
2. 页面工厂:
Selenium WebDriver 提供了一个名为 PageFactory 的类,它有助于辅助设计模式的页面对象。在这种情况下,开发人员使用注释“@FindBy”。有一种称为“initElements”方法的方法,用于初始化网络元素。
POM 和 PageFactory 的区别:
S.No. | POM | PageFactory |
---|---|---|
1. | It is an approach for Design patterns. | It is a class that is provided by Selenium Webdriver. |
2. | It is not an optimal method to process tasks. | It is an optimal method to process tasks. |
3. | It helps in separating page objects and scripts. | It is a technique to implement POM. |
4. | ‘By’ annotation is used to define page objects. | It uses annotation ‘FindBy’ to describe page objects. |
5. | It does not handle exceptions efficiently. | It efficiently handles the exceptions. |
6. | It requires the initialization of every object. | It does not require the initialization of every object. |
7. | There is cache storage for performing tasks. | There is no need for cache storage. |