1.页面对象模型(POM):
Page的对象是一个OOPs类,它充当被测应用程序网页的接口,并且实际上是一种设计模式,通常在Selenium用于测试用例的自动化。该POM中的页面类结合了Web因素和与Web元素互动的技术。
2. PageFactory:
Selenium WebDriver提供了一个名为PageFactory的类,该类有助于辅助设计模式的Page Object。在这种情况下,开发人员使用注释“ @FindBy”。有一种称为“ initElements”方法的方法,用于初始化Web元素。
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. |