@Test
public void verifyWelcomeTextIsDisplayedOnMainPage() {
String expectedWelcomeText = "&&"; //символы или текст, который нужно найти
WebElement elementWelcomeText = DriverProvider.getDriver().findElement(By.xpath("//div[contains(@class, 'content animation-screen')]")); //указываем на элемент со страницы, в котором находится нужная нам строка
String actualWelcomeText = elementWelcomeText.getText();
Assert.assertEquals(actualWelcomeText.contains(actualWelcomeText), expectedWelcomeText.contains(expectedWelcomeText), "There is no symbols &&");
}
或常规:
使用
contains例如。文档
String 类有一个方法
int indexOf(String sub)对于自动化测试人员,以下解决方案将很有用: