After submitting the request, there are two possible options:
The request cannot be executed and a notification about the rejection of the request will appear
The request can be executed and a button will appear to confirm the request. Now the implementation is as follows, try waits for a rejection notification, and if not executed by timeout, then except looks for a request confirmation button. The disadvantage of this approach is that it takes 10 minutes to process the request. And if the button for confirming the request appears at 5 seconds, then all the same there will be a 10 minute wait for the notification about the rejection of the request, we lose time. I saw on the Internet the approach of waiting for two elements through the lambda functions of Python, but I could not figure out what and how. Can someone help? or suggest alternative solutions to the problem
def reject_request(self): id_pending = self._get_element_text(Main.pending_locates.pending_id) try: self._wait_for_visible(Main.pending_locates.reject_window) id_result = self._get_element_text(Main.results.result_id) assert id_pending == id_result, 'The ID of the request is not found in the result table' print('Your request automatically rejected') except TimeoutException: self._click(Main.pending_locates.button_reject) sleep(1) id_result = self._get_element_text(Main.results.result_id) assert id_pending == id_result, 'The ID of the request is not found in the result table' print('Your request manually Rejected') return self
I want to implement it in a way similar to this, but I have little experience. If anyone can help I will explain in more detail