Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

page crash, Selenium issue #9729

Open
DanielOsypenko opened this issue Apr 25, 2024 · 2 comments
Open

page crash, Selenium issue #9729

DanielOsypenko opened this issue Apr 25, 2024 · 2 comments

Comments

@DanielOsypenko
Copy link
Contributor

happened twice with test test_new_sc_new_rbd_pool[3-aggressive-Immediate-Bound]

https://reportportal-ocs4.apps.ocp-c1.prod.psi.redhat.com/ui/#ocs/launches/632/20634/990073/990092/log?logParams=history%3D990092%26page.page%3D1

https://reportportal-ocs4.apps.ocp-c1.prod.psi.redhat.com/ui/#ocs/launches/632/20602/988324/988343/log

E selenium.common.exceptions.WebDriverException: Message: unknown error: session deleted because of page crash
E from unknown error: cannot determine loading status
E from tab crashed

@ebondare
Copy link
Contributor

ebondare commented Apr 26, 2024

@DanielOsypenko
Copy link
Contributor Author

upd:
all tests mentioned are failing within this code block:

` def page_has_loaded(
self, retries=5, sleep_time=2, module_loc=("html", By.TAG_NAME)
):
"""
Waits for page to completely load by comparing current page hash values.
Not suitable for pages that use frequent dynamically content (less than sleep_time)

    Args:
        retries (int): How much time in sleep_time to wait for page to load
        sleep_time (int): Time to wait between every pool of dom hash
        module_loc (tuple): locator of the module of the page awaited to be loaded
    """

    @retry(TimeoutException)
    def get_page_hash():
        """
        Get dom html hash
        """
        self.check_element_presence(module_loc[::-1])
        dom = self.get_element_attribute(module_loc, "innerHTML")
        dom_hash = hash(dom.encode("utf-8"))
        return dom_hash

    page_hash = "empty"
    page_hash_new = ""

    # comparing old and new page DOM hash together to verify the page is fully loaded
    retry_counter = 0
    while page_hash != page_hash_new:
        if retry_counter > 0:
            logger.info(f"page not loaded yet: {self.driver.current_url}")
        retry_counter += 1
        page_hash = get_page_hash()
        time.sleep(sleep_time)
        page_hash_new = get_page_hash()
        if retry_counter == retries:
            logger.error(
                f"Current URL did not finish loading in {retries * sleep_time}"
            )
            self.take_screenshot()
            return
    logger.info(f"page loaded: {self.driver.current_url}")

`

it seems to be overwhelming to get page has every 2 seconds
retry_counter += 1 page_hash = get_page_hash() time.sleep(sleep_time) page_hash_new = get_page_hash()

  1. we need to minimize calling page_has_loaded, especially on Page Objects, similarly to StorageSystemTab(DataFoundationTabBar, CreateResourceForm) -> just remove CreateResourceForm.init from StorageSystemTab constructor
  2. reduce volume of page hash we are copying, maybe remove footer, header, static elements
  3. increase mem limits to SeleniumDriver

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants