I am trying to find and click a close button on an iframe.
<button _ngcontent-bti-c9="" aria-label="Close" class="close close_white_color" type="button">
<span _ngcontent-bti-c9="" aria-hidden="true">×</span>
</button>
I have tried the following methods:
Try1: close = driver.find_element_by_xpath("//button[@aria-label=Close']").click()
Try2: close = driver.find_element_by_xpath("//button[@class='close close_white_color']").click()
Try3: close = driver.find_element_by_xpath("//span[@aria-hidden='true']").click()
which gives following error
Error1: NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//button[@aria-label='Close']"}
Error2: NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//button[@class='close close_white_color']"}
I am able to interact with the iframe but unable to locate this button. Any suggestions would be appreciated