Es sind mehr als 100 und ich konnte nicht 100 Code schreiben, um ein Element zu testen.
Ist es möglich, die Groß-/Kleinschreibung zu verwenden, um das Element zu testen? Ich möchte und nicht alle.
Hier zum Beispiel muss ich 3 Tests ausführen. Ich möchte nur Test1 und Test2 testen. Wie kann ich das mit dem Schalter tun? Fall in Java, weil ich mehr habe Da mehr als 100 Tests ausgeführt werden müssen, möchte ich nur einen Code verwenden.
Vielen Dank
Code: Select all
//TEST1
try {
driver.findElement(By.xpath(CmpList._google)).isDisplayed();
System.out.println("Google Tab exists");
driver.findElement(By.xpath(CmpList._google)).click();
} catch (NoSuchElementException e) {
System.out.println("TEST FAILED--Google Tab element does not exist");
} finally {
System.out.println("Continue");
}
//TEST2
try {
driver.findElement(By.xpath(CmpList._radio)).isDisplayed();
System.out.println("Radio Tab element exists");
driver.findElement(By.xpath(CmpList._radio)).click();
} catch (NoSuchElementException e) {
System.out.println("TEST FAILED--Radio Tab element does not exist");
} finally {
System.out.println("Continue");
}
//TEST3
try {
driver.findElement(By.xpath(CmpList._yahoo)).isDisplayed();
System.out.println("Google Tab exists");
driver.findElement(By.xpath(CmpList._yahoo)).click();
} catch (NoSuchElementException e) {
System.out.println("TEST FAILED--Yahoo Tab element does not exist");
} finally {
System.out.println("Continue");
}