
Object Repository
Object Repository הוא תבנית עיצוב ליצירת מאגר אובייקטים עבור רכיבי ממשק משתמש באינטרנט.
בדומה ל- Page Object Factory ול- Object RepositoryPage .
מומלץ ביותר להשתמש ב- Page Object Factory
Repository from External file
1 Create Repository.properties

2 Connection to Repository.properties file
static WebDriver driver;
static Properties pro;
@BeforeClass
public static void open_web() throws Exception
{
System.setProperty("webdriver.gecko.driver","C:\\eclipse\\Firefox driver\\geckodriver.exe");
driver = new FirefoxDriver();
// Specify the file location I used . operation here because
//we have object repository inside project directory only
File src=new File("Repository.properties");
// Create FileInputStream object
FileInputStream fis=new FileInputStream(src);
// Create Properties class object to read properties file
pro=new Properties();
pro.load(fis);
}
@Test
public void a_test()
{
driver.get(pro.getProperty("zim.url.main"));
Select mySelect = new Select(driver.findElement(By.id(pro.getProperty("zim.tools.demurrage.country.id"))));
mySelect.selectByVisibleText("Israel");
mySelect = new Select(driver.findElement(By.id(pro.getProperty("zim.tools.demurrage.port.id"))));
mySelect.selectByVisibleText("Ashdod -- Israel");
driver.findElement(By.xpath(pro.getProperty("zim.tools.demurrage.Search.xpath"))).click();
}

Repository from Internal file
