TestProject Forum

Using driver.quit() in testproject sdk, does not stop execution

The execution of a test using python open-sdk does not stop after driver.quit(). Initially I provided a very long delay after driver.quit() for the execution to finish so I can fetch the reports. The job status on the dashboard showed “executing”, long after the driver was killed. I then implemented the following code and it goes into an infinite loop.
Note: I am using the latest agent version.

__flag = False
driver = webdriver.Chrome(project_name="abc", job_name="xyz")
driver.quit()
while not __flag:
            time.sleep(10)
            response = session.get(f'{settings.BASE_URL}/projects/{settings.PROJECT_ID}/jobs/{job_id}/executions/{execution_id}/state')
            print(response.json())
            if response.json()["state"] not in ["Ready", "Executing", "Reporting"]:
                 __flag = True

Hi @prathik,
You cannot get a report of an execution which is currently ongoing (in executing state).
Try in your execution to always get the report of the latest test instead of the current one, so that way the report will always be ready on the cloud for you pull it in your request.