首页 > 代码库 > The Thinking of AutomaticTest(有关UI自动化的思考)
The Thinking of AutomaticTest(有关UI自动化的思考)
- 容易维护
- 简洁易懂
- 代码重用性好
- 系统的稳定性强
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();
}
}
The Thinking of AutomaticTest(有关UI自动化的思考)