webdriver_test_tools.common.cmd.argparse module

Extended ArgumentParser class and common argparse utilities

class webdriver_test_tools.common.cmd.argparse.ArgumentParser(prog=None, usage=None, description=None, epilog=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True, allow_abbrev=True)[source]

Bases: argparse.ArgumentParser

Extended ArgumentParser class with support for default subparser

set_default_subparser(name, subcommand_arg_position=1)[source]

default subparser selection. Call after setup, just before parse_args()

Parameters
  • name – is the name of the subparser to call by default

  • subcommand_arg_position – (Default: 1) The position where subcommand arguments should be. 0 is the name of the module being run, so should be > 0

Based on: https://stackoverflow.com/a/26379693

webdriver_test_tools.common.cmd.argparse.ARGPARSE_EPILOG = 'For more information, visit <https://connordelacruz.com/webdriver-test-tools/>'

Generic “for more information” argument parser epilog

webdriver_test_tools.common.cmd.argparse.get_generic_parent_parser(include_version=False)[source]

Returns a generic ArgumentParser with --help and (optionally) --version arguments

Parameters

include_version – (Default: False) If True, include --version argument

Returns

Generic ArgumentParser with a ‘General’ argument group with --help and (optionally) --version arguments