I want to check if my entered information is inserted into the list in the table of the html page but working with tables is a little bit more difficult than a normal list. Could someone help me?

My html page:

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Sharingbox WebApp</title>

    <h1>Overzicht van verhuringen</h1>

    <table border="1" style="width: 100%,">

            <td>Sharingbox ID</td>

        <c:forEach items="${verhuringen}" var="verhuring">

            <c:url var="verhuringUrl" value="/verhuring.html">
                <c:param name="id" value="${verhuring.id}" />


                <td><a href='<c:out value="${verhuringUrl}"/>'> <c:out
                            value="${verhuring.id}" />

                <td><c:out value="${verhuring.datum}" /></td>
                <td><c:out value="${verhuring.leveringsadres}" /></td>
                <td><c:out value="${verhuring.sharingbox_id}" /></td>
                <td><c:out value="${verhuring.status}" /></td>
                <td><c:out value="${verhuring.tevredenheidsscore}" /></td>


    <br />
    <br />
    <c:url var="nieuweVerhuringUrl" value="/nieuweVerhuring.html" />
    <a href='<c:out value="${nieuweVerhuringUrl}"/>'>Verhuring

Information to check:

| column            | information       |

| Datum             | 12/11/2016        |

| Leveringsadres    | poodlaar          |

| Sharingbox_ID     | 0                 |

| Status:           | In behandeling    |

Step definition:

@Then("^I should see a list containing$")
public void i_should_see_a_list_containing(List<Columninformation>    checklist) throws Throwable {
String bodyText = driver.findElement(By.tagName("body")).getText();
for (Columninformation ld: checklist){
    String text2bFound = ld.information;
Assert.assertTrue("Did not find this text:"+text2bFound+"\n",bodyText.contains(text2bFound));

Could some one guide/help me to write a xpath?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.