TestProject Forum

How to use adaptive wait in Python SDK

Hi there,

I am using Python SDK in TestProject and am new to Python. I would like to know how to use adaptive wait in Python code. When I type driver. to check the available options I get this and am not sure which option to use. Any help would be appreciated.

image

@b.rani First of all, welcome to our community :smiley:
To use adaptive wait in Python in a specific step, you have to choose the option “step settings”
I’m putting you a screenshot here:
Screenshot 2021-12-13 131233

If you want more information about PythonSDK, we have our GitHub. It can be beneficial, so I’m putting you another link here:

1 Like

Thank you @alex.ivanov. I wanted to use it at a global level in Python SDK like we have option when using the Recorder or UI. But definitely, I will check GitHub for more info.

You can set the timeouts for the test globally when setting up the driver:

@pytest.fixture()
def driver():
    driver = webdriver.Chrome(token="dev-token",
                              project_name="My first Project",
                              job_name="Web test")
    step_settings = StepSettings(timeout=35000,
                                 sleep_time=500,
                                 sleep_timing_type=SleepTimingType.Before)
    with DriverStepSettings(driver, step_settings):
        yield driver
    driver.quit()

Or you can set specific timeout settings for a step:

    step_settings = StepSettings(timeout=6000)
    with DriverStepSettings(driver, step_settings):
        driver.get(f'{ApplicationURL}')
1 Like

Thank you @alex.ivanov. Really appreciated your quick reply. It is giving me the confidence to get started with TestProject that my questions will be answered and I will not get stuck.