First I have a code that finds the element :
@property
def tools_button(self):
driver: WebDriver = current().context.driver
return driver.find_element(
SelectBy.XPATH, f"//button[contains(text(),'Tools')]"
)
--------------------------------------------------------------------
tools_button = locators.tools_button
this tools button is in a modal that disappears after I click the Close Button.
My question is, how do i find element's invisibility similar to what this code does:
wait.until(
ui.EC.invisibility_of_element_located(
(SelectBy.XPATH, "//button[contains(text(),'Tools')]")
)
)
I need to check if the modal was closed or not, by checking the invisibility of the Tools Button in that modal.
But I need to find the Tools Button without having to pass the xpath and "by" again. is there a way to extract those two attributes from the already found element? or is there some special way to provide the invisibility_of_element_located function whole element.
You can use the invisibility_of expected condition along with the WebElement directly, without passing the locator again. Here's how you can achieve it