Q:

Selenium Python how would verify a html table contains no data, the table is empty

I have a HTML table on a webpage and the table is empty.  It contains no data as the data has been deleted by a previous test.
For this test I would like to check, verify the html table is empty, it contains no data.
What is the best way to check this?  I was thinking of using an Xpath like the following:
//table[@id="data_configuration_edit_data_object_tab_address_rules_tb_level_rules_locality"]//tr//td//div[text()=""]

The HTML snippet is:
<table id="data_configuration_edit_data_object_tab_address_rules_tb_level_rules_locality" class="GFNQNVHJE border" cellspacing="0" __gwtcellbasedwidgetimpldispatchingfocus="true" __gwtcellbasedwidgetimpldispatchingblur="true" style="min-width: 350px;">
<thead aria-hidden="false">
    <colgroup>
        <tbody style="display: none;"/>
        <tbody>
            <tr>
                <td align="center" colspan="2">
                    <div>
                        <div class="" style="width: 100%; height: 100%; padding: 0px; margin: 0px;" aria-hidden="false">
                            <div class="" style="width: 100%; height: 100%;" aria-hidden="false">
                                <div class="gwt-Label">No data to display.</div>
                            </div>
                        </div>
                        <div style="width: 100%; height: 100%; padding: 0px; margin: 0px; display: none;" aria-hidden="true">
                            <div class="GFNQNVHBE" style="width: 100%; height: 100%; display: none;" aria-hidden="true">
                                <div class="gwt-Label"></div>
                            </div>
                        </div>
                    </div>
                </td>
            </tr>
        </tbody>
        <tfoot style="display: none;" aria-hidden="true"/>
    </table>

Thanks, Riaz

A:

Assuming that the only visible text in the <table> when it is empty is "No data to display.", then you can simplify the XPath as follow (formatted for readability) :
//table[
    @id="data_configuration_edit_data_object_tab_address_rules_tb_level_rules_locality" 
        and 
    .='No data to display.'
]

xpatheval demo

