How to use remove_output_dir method in SeleniumLibrary

Best Python code snippet using SeleniumLibrary

Run SeleniumLibrary automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

run.py

Source: run.py Github

copy
1#!/usr/bin/env python
2
3import os
4import shutil
5import sys
6from os.path import abspath, dirname, join
7
8from pytest import main as py_main
9
10
11CURDIR = dirname(abspath(__file__))
12SRC = join(CURDIR, os.pardir, 'src')
13
14
15def remove_output_dir():
16    output_dir = os.path.join(CURDIR, 'output_dir')
17    if os.path.exists(output_dir):
18        shutil.rmtree(output_dir)
19    os.mkdir(output_dir)
20
21
22def run_unit_tests():
23    sys.path.insert(0, SRC)
24    try:
25        result = py_main(['--rootdir=%s' % CURDIR, '-p', 'no:cacheprovider', CURDIR])
26    finally:
27        sys.path.pop(0)
28    return result
29
30
31if __name__ == '__main__':
32    remove_output_dir()
33    sys.exit(run_unit_tests())
34
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Run Python Tests on LambdaTest Cloud Grid

Execute automation tests with SeleniumLibrary on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)