I have the below code
After coming back to main window unable to get focus and disconnect button is not getting clicked
parent_handle = driver.window_handles[0]
#clicks on link
driver.find_element_by_xpath("//*[@id='content']/div[4]/div/p/a").click()
child_handle = [x for x in driver.window_handles if x != parent_handle][0]
driver.switch_to.window(child_handle)
time.sleep(2)
#will work on this winow
driver.close()
driver.switch_to.window(parent_handle)
time.sleep(30)
#click on Disconnect button on toolbar on main window
driver.find_element_by_xpath("//a[contains(text(), 'btn btn-outline-dark et-disconnect-link et-disconnect-warning-link')]").click()
I tried several ways but getting the below error
selenium.common.exceptions.NoSuchElementException: Message: no such element:
Unable to locate element: {"method":"xpath","selector":"//a[contains(text(), 'btn btn-outline-dark et-disconnect-link et-disconnect-warning-link')]"}
(Session info: chrome=79.0.3945.117)