The Thinking of AutomaticTest(有关自动化测试的思考)
- 容易维护
- 简洁易懂
- 代码重用性好
- 系统的稳定性强
public static void unifyClickMethods(WebDriver driver,String key,String value) {
if(key.contains("IdClick")) {
driver.findElement(By.id(value)).click();
}
if(key.contains("ClassNameClick")) {
driver.findElement(By.className(value)).click();
}
if(key.contains("LinktextClick")) {
driver.findElement(By.linkText(value)).click();
}
if(key.contains("NameClick")) {
driver.findElement(By.name(value)).click();
}
if(key.contains("PartialLinkTextClick")) {
driver.findElement(By.partialLinkText(value)).click();
}
if(key.contains("XpathClick")) {
driver.findElement(By.xpath(value)).click();
}
if(key.contains("TagNameClick")) {
driver.findElement(By.tagName(value)).click();
}
}