【发布时间】:2022-01-05 03:14:09
【问题描述】:
我正在使用这个简单的函数来获取并打印出 XML 响应中的值:
@Test
void validateXMLResponse() {
String book = RestAssured.given().when()
.get("https://chercher.tech/sample/api/books.xml")
.then().extract().path("bookstore.book.title");
System.out.println(book);
}
但我在控制台中收到此错误:
java.lang.ClassCastException: class io.restassured.internal.path.xml.NodeChildrenImpl cannot be cast to class java.lang.String (io.restassured.internal.path.xml.NodeChildrenImpl is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap')
【问题讨论】:
标签: rest-assured