I am writing a test for cancel a data request at the page: https://school.moodledemo.net/admin/tool/dataprivacy/mydatarequests.php
There is a pop-up when cancel a data request
My code to catch this:
def cancelRequest(self):
toggle_button = self.driver.find_element(By.ID, "action-menu-toggle-1")
toggle_button.click()
cancel_button = self.driver.find_element(By.ID, "actionmenuaction-1")
cancel_button.click()
try:
self.driver.implicitly_wait(10)
self.driver.find_element(By.LINK_TEXT, "Cancel request").click()
except:
print("nothing")
But I cannot choose the cancel request button. It always prints nothing. Can anybody help me? Thanks
If this an alert pop up message, it is recommended to employ the 'alert' method for its implementation.
alert = driver.switch_to.alert
If you wish to proceed with accepting the pop-up message, kindly write this after switching to alert.
alert.accept()
Conversely, should you choose to decline the message, You can provide this
alert.dismiss()