-
Notifications
You must be signed in to change notification settings - Fork 2
04. How to read from JSON to Page Factory
Hemanth Sridhar edited this page Nov 6, 2021
·
5 revisions
[
{
"name": "forgottenPasswordLinkInAlert",
"type": "xpath",
"value": "//div[@role='alert']/descendant::a"
},
{
"name": "error_msg",
"type": "xpath",
"value": "//div[@role='alert']"
}
]
- name : name of the locator
- type : type of the locator
- value : value of the locator
@FilePath(value = PageObjectsConfig.ERROR_MSG_PAGE)
public class ErrorPopupPage extends PageInitializer {
@SearchBy
private WebElement forgottenPasswordLinkInAlert;
@SearchBy(nameOfTheLocator="error_msg")
private WebElement errorMsg;
}
- The @FilePath value must be the path to the json
- The nameOfTheLocator value is optional. By default, the variable name is picked up.