Element is no longer attached to the DOM
<p>I am writing a test, where i create an ip pool for the application , and then in the next step, delete it.</p>

<p>The function is as follows:</p>

<pre><code>def remove_passed_ip(self, ip):
    """ Find and ip and delete it
        Args:
            ip (str): the name of ip to click and delete

        Returns:
            webelement
    """
    index = -1
    try:
        ipDelBtnList = self.wait_for_presence_of_all_elements(self.onboarding_select_address_pools_delete_btn_list)
        ipList = self.wait_for_presence_of_all_elements(self.onboarding_select_address_pools_list)
        time.sleep(5)
    except:
        self.log.info("dasdda")
    else:
        for ips in ipList:
            index +=1
            temp = ips.text.split('/')
            if str(ip)==str(temp[0]):
                ipHandle = ipDelBtnList[index]
                time.sleep(5)
                ipHandle.click()
                time.sleep(15)
</code></pre>

<p>The delete action works fine and the created ip is deleted, but after this when the test ends, it gives the error as </p>

<pre><code>Message: Element is no longer attached to the DOM
</code></pre>

<p>Please provide with any pointers to resolve this issue. If any other clarification is required regarding the question, please let me know.</p>