Selenium webdriver TestNg断言失败跳过测试数据驱动迭代器

Selenium webdriver TestNg断言失败跳过测试数据驱动迭代器,selenium-webdriver,testng,Selenium Webdriver,Testng,我正在使用迭代器运行搜索,并使用TestNG Assert.assertFail进行断言。 我使用try{}catch{}机制处理代码,以确保在断言失败时测试不会中断。但是我发现在断言失败的情况下代码会中断,我正在寻找一种方法,在断言失败的情况下,WebDriver应该使用迭代器列表中的下一条记录进行搜索。请帮忙 while (countryListiterator.hasNext()) { Thread.sleep(2500); countr

我正在使用迭代器运行搜索,并使用TestNG Assert.assertFail进行断言。 我使用try{}catch{}机制处理代码,以确保在断言失败时测试不会中断。但是我发现在断言失败的情况下代码会中断,我正在寻找一种方法,在断言失败的情况下,WebDriver应该使用迭代器列表中的下一条记录进行搜索。请帮忙

while (countryListiterator.hasNext()) {

            Thread.sleep(2500);

            countryListiteratorNextVAL = countryListiterator.next();

            searchResultPO toSearchpage = homeTosearch
                    .search(countryListiteratorNextVAL);

            // Do an Assertion here, if fails the test-ng class breaks without going to the next record.
                 Assert.assertFalse(boolean  condition)

        }

按照设计,它会失效/断裂。您必须按照链接重新创建断言