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

improve #24

Closed
GavinIves opened this issue Aug 3, 2023 · 1 comment
Closed

improve #24

GavinIves opened this issue Aug 3, 2023 · 1 comment

Comments

@GavinIves
Copy link

Adding a time.sleep to this function can prevent the browser from slowing down and the logo being output has not been loaded. This situation often occurs on computers with poor performance.

def wait_to_disappear(self, by, query, sleep_duration=1):
'''
Waits until the specified web element disappears from the page.

    This function continuously checks for the presence of a web element.
    It waits until the element is no longer present on the page.
    Once the element has disappeared, the function returns.

    Args:
        by (selenium.webdriver.common.by.By): The method used to locate the element.
        query (str): The query string to locate the element.
        sleep_duration (int, optional): The duration to sleep between checks. Default: 1.

    Returns:
        None
    '''
    !!!!!!!!!!!!here!!!!!!
    time.sleep(1)
    !!!!!!!!!!!! here !!!!!!!!
    while True:
        thinking = self.browser.find_elements(by, query)
        if len(thinking) == 0:
            logging.info(f'Element {query} is present, waiting')
            break
        time.sleep(sleep_duration)
    return
@ugorsahin
Copy link
Owner

Hey,

I reworked the wait_until_disappear function. Perhaps that can have an effect on your problem.

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

No branches or pull requests

2 participants