Я пытался
HTMLElement[] focused = response.getElementsWithAttribute("class", "focused");
Я надеялся, что он найдет
<span class="focused">Submit</span>
среди других, но все, что я получаю, это пустой массив.
У Google естьмне не помогло.
Итак.Если бы вы были мной и хотели получить массив HTMLElements по имени класса, что бы вы использовали?
Редактировать:
Источник
public class ExampleIT extends TestCase {
private final String BASE = "http://localhost:8080/preview.htm?";
@Test
public void testFocusedArePresent() throws MalformedURLException, SAXException, IOException {
WebConversation conversation = new WebConversation();
WebResponse response = conversation.getResponse(BASE + "template=Sample");
HTMLElement[] focused = response.getElementsWithAttribute("class", "focused");
assertTrue(focused.length > 0);
}
}
Я надеюсь, чтопомогает.