Wait conditions

Wait conditions in Selenium are mechanisms that allow to wait for certain conditions before performing the next actions. They are used for synchronization between the test and the web application to ensure that elements or pages are fully loaded and ready for interaction. This helps to avoid errors related to elements not yet appearing on the page or not being fully loaded.

Pomcorn includes several custom waiting conditions that complement the built-in Selenium waiting list. About Selenium wait conditions you can read here.

Package wait conditions

pomcorn.waits_conditions.url_not_matches(pattern: str) Callable[[WebDriver], bool][source]

Represent wait condition to check that url doesn’t match pattern.

pomcorn.waits_conditions.text_in_element_changes(element: PomcornElement[TLocator] | TLocator, old_text: str) Callable[[WebDriver], bool][source]

Represent wait condition to check that text doesn’t match old text.

Parameters:
  • element – The element in which the text will be checked.

  • old_text – The old text that should disappear.

pomcorn.waits_conditions.element_not_exists_in_dom(element: PomcornElement[TLocator] | TLocator) Callable[[WebDriver], bool][source]

Represent wait condition to check that element not exists in DOM.

pomcorn.waits_conditions.text_not_to_be_present_in_element_attribute(locator: tuple[str, str], attribute_: str, text_: str) Callable[[WebDriver | WebElement], bool][source]

Represent wait condition that checks that text is not in attribute.

NOTE: “_” in argument names added for consistent with selenium’s built-in wait condition text_to_be_present_in_element_attribute

Parameters:
  • locator – A tuple with a By instance and a string value. You can get them from the Locators classes.

  • attribute – Attribute name.

  • text – Text that should disappear.