保捱科技网
您的当前位置:首页Warning:The method assertEquals(String, String) from the type Assert is deprecated

Warning:The method assertEquals(String, String) from the type Assert is deprecated

来源:保捱科技网

在调用assertEquals校验的时候,遇到了Warning:The method assertEquals(String, String) from the type Assert is deprecated(大意说Assert类下的assertEquals方法调用被禁止),代码如下:

 public void explictedWaitTest(){
	  try {
		  WebElement textInputBox=(new WebDriverWait(driver, 10))
				  .until(new ExpectedCondition<WebElement>() {
					  @Override
					  public WebElement apply(WebDriver d){
						  return d.findElement(By.id("text"));
					  }
		});
		Assert.assertEquals("今年夏天西瓜相当甜!",textInputBox.getAttribute("value"));
	} catch (NoSuchElementException e) {
		e.printStackTrace();
	}
  }

解决办法:需要导入包org.junit.Assert,在导入那里加上import org.junit.Assert;就好了

因篇幅问题不能全部显示,请点此查看更多更全内容