How to use property file as a object repository in Selenium WebDriver Automation? -


How to use asset files as an object repository in Selenium Web Drivers Automation?

I am asking for instructions about setup and the steps I need to take to get it.

Password

Create a class to load the properties file. You can use the snippet below: Note: path / src / main / resources / com / framework / properties / a sample path And can change according to your structure

  public class PropertyManager {personal constant last property property = new property}; personal static final string FRAMEWORKPROPERTIESPATH = "/ src / main / resources / com / Outline / property / "; personal constant last log Load LOGGER = loggcreateLogger (); LoadPropertyFile of Static Properties (String PropertiesElload) {Try {PROPERTY.load (New File InputStream (System.GetProperty ("User Dyer") + FrameVorpProperty + PropertyTroload));} Hold (IOException io) {LOGGER.info ("IOException in loadFrameworkPropertyFile () PropertyManager class method", io); Runtime.getRuntime () Halt (0);} return property;}}   

When you Use the snippet below if you want to use variables from the properties category C to:

  private static final properties LOCATORPROPERTIES = PropertyManager. LoadPropertyFile ("framework.properties"); Public Zero Click () {driver.findElement (By.id (LOCATORPROPERTIES.getProperty ("locator1"))); }    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -