partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | download_data | Download `url` to destination `fname`. | fastai/datasets.py | def download_data(url:str, fname:PathOrStr=None, data:bool=True, ext:str='.tgz') -> Path:
"Download `url` to destination `fname`."
fname = Path(ifnone(fname, _url2tgz(url, data, ext=ext)))
os.makedirs(fname.parent, exist_ok=True)
if not fname.exists():
print(f'Downloading {url}')
downloa... | def download_data(url:str, fname:PathOrStr=None, data:bool=True, ext:str='.tgz') -> Path:
"Download `url` to destination `fname`."
fname = Path(ifnone(fname, _url2tgz(url, data, ext=ext)))
os.makedirs(fname.parent, exist_ok=True)
if not fname.exists():
print(f'Downloading {url}')
downloa... | [
"Download",
"url",
"to",
"destination",
"fname",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/datasets.py#L206-L213 | [
"def",
"download_data",
"(",
"url",
":",
"str",
",",
"fname",
":",
"PathOrStr",
"=",
"None",
",",
"data",
":",
"bool",
"=",
"True",
",",
"ext",
":",
"str",
"=",
"'.tgz'",
")",
"->",
"Path",
":",
"fname",
"=",
"Path",
"(",
"ifnone",
"(",
"fname",
... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | untar_data | Download `url` to `fname` if `dest` doesn't exist, and un-tgz to folder `dest`. | fastai/datasets.py | def untar_data(url:str, fname:PathOrStr=None, dest:PathOrStr=None, data=True, force_download=False) -> Path:
"Download `url` to `fname` if `dest` doesn't exist, and un-tgz to folder `dest`."
dest = url2path(url, data) if dest is None else Path(dest)/url2name(url)
fname = Path(ifnone(fname, _url2tgz(url, dat... | def untar_data(url:str, fname:PathOrStr=None, dest:PathOrStr=None, data=True, force_download=False) -> Path:
"Download `url` to `fname` if `dest` doesn't exist, and un-tgz to folder `dest`."
dest = url2path(url, data) if dest is None else Path(dest)/url2name(url)
fname = Path(ifnone(fname, _url2tgz(url, dat... | [
"Download",
"url",
"to",
"fname",
"if",
"dest",
"doesn",
"t",
"exist",
"and",
"un",
"-",
"tgz",
"to",
"folder",
"dest",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/datasets.py#L221-L234 | [
"def",
"untar_data",
"(",
"url",
":",
"str",
",",
"fname",
":",
"PathOrStr",
"=",
"None",
",",
"dest",
":",
"PathOrStr",
"=",
"None",
",",
"data",
"=",
"True",
",",
"force_download",
"=",
"False",
")",
"->",
"Path",
":",
"dest",
"=",
"url2path",
"(",... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | Config.get_key | Get the path to `key` in the config file. | fastai/datasets.py | def get_key(cls, key):
"Get the path to `key` in the config file."
return cls.get().get(key, cls.DEFAULT_CONFIG.get(key,None)) | def get_key(cls, key):
"Get the path to `key` in the config file."
return cls.get().get(key, cls.DEFAULT_CONFIG.get(key,None)) | [
"Get",
"the",
"path",
"to",
"key",
"in",
"the",
"config",
"file",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/datasets.py#L140-L142 | [
"def",
"get_key",
"(",
"cls",
",",
"key",
")",
":",
"return",
"cls",
".",
"get",
"(",
")",
".",
"get",
"(",
"key",
",",
"cls",
".",
"DEFAULT_CONFIG",
".",
"get",
"(",
"key",
",",
"None",
")",
")"
] | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | Config.get | Retrieve the `Config` in `fpath`. | fastai/datasets.py | def get(cls, fpath=None, create_missing=True):
"Retrieve the `Config` in `fpath`."
fpath = _expand_path(fpath or cls.DEFAULT_CONFIG_PATH)
if not fpath.exists() and create_missing: cls.create(fpath)
assert fpath.exists(), f'Could not find config at: {fpath}. Please create'
with op... | def get(cls, fpath=None, create_missing=True):
"Retrieve the `Config` in `fpath`."
fpath = _expand_path(fpath or cls.DEFAULT_CONFIG_PATH)
if not fpath.exists() and create_missing: cls.create(fpath)
assert fpath.exists(), f'Could not find config at: {fpath}. Please create'
with op... | [
"Retrieve",
"the",
"Config",
"in",
"fpath",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/datasets.py#L165-L170 | [
"def",
"get",
"(",
"cls",
",",
"fpath",
"=",
"None",
",",
"create_missing",
"=",
"True",
")",
":",
"fpath",
"=",
"_expand_path",
"(",
"fpath",
"or",
"cls",
".",
"DEFAULT_CONFIG_PATH",
")",
"if",
"not",
"fpath",
".",
"exists",
"(",
")",
"and",
"create_m... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | Config.create | Creates a `Config` from `fpath`. | fastai/datasets.py | def create(cls, fpath):
"Creates a `Config` from `fpath`."
fpath = _expand_path(fpath)
assert(fpath.suffix == '.yml')
if fpath.exists(): return
fpath.parent.mkdir(parents=True, exist_ok=True)
with open(fpath, 'w') as yaml_file:
yaml.dump(cls.DEFAULT_CONFIG, ya... | def create(cls, fpath):
"Creates a `Config` from `fpath`."
fpath = _expand_path(fpath)
assert(fpath.suffix == '.yml')
if fpath.exists(): return
fpath.parent.mkdir(parents=True, exist_ok=True)
with open(fpath, 'w') as yaml_file:
yaml.dump(cls.DEFAULT_CONFIG, ya... | [
"Creates",
"a",
"Config",
"from",
"fpath",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/datasets.py#L173-L180 | [
"def",
"create",
"(",
"cls",
",",
"fpath",
")",
":",
"fpath",
"=",
"_expand_path",
"(",
"fpath",
")",
"assert",
"(",
"fpath",
".",
"suffix",
"==",
"'.yml'",
")",
"if",
"fpath",
".",
"exists",
"(",
")",
":",
"return",
"fpath",
".",
"parent",
".",
"m... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | MixUpCallback.on_batch_begin | Applies mixup to `last_input` and `last_target` if `train`. | fastai/callbacks/mixup.py | def on_batch_begin(self, last_input, last_target, train, **kwargs):
"Applies mixup to `last_input` and `last_target` if `train`."
if not train: return
lambd = np.random.beta(self.alpha, self.alpha, last_target.size(0))
lambd = np.concatenate([lambd[:,None], 1-lambd[:,None]], 1).max(1)
... | def on_batch_begin(self, last_input, last_target, train, **kwargs):
"Applies mixup to `last_input` and `last_target` if `train`."
if not train: return
lambd = np.random.beta(self.alpha, self.alpha, last_target.size(0))
lambd = np.concatenate([lambd[:,None], 1-lambd[:,None]], 1).max(1)
... | [
"Applies",
"mixup",
"to",
"last_input",
"and",
"last_target",
"if",
"train",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/callbacks/mixup.py#L15-L33 | [
"def",
"on_batch_begin",
"(",
"self",
",",
"last_input",
",",
"last_target",
",",
"train",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"train",
":",
"return",
"lambd",
"=",
"np",
".",
"random",
".",
"beta",
"(",
"self",
".",
"alpha",
",",
"self",... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | make_date | Make sure `df[field_name]` is of the right date type. | fastai/tabular/transform.py | def make_date(df:DataFrame, date_field:str):
"Make sure `df[field_name]` is of the right date type."
field_dtype = df[date_field].dtype
if isinstance(field_dtype, pd.core.dtypes.dtypes.DatetimeTZDtype):
field_dtype = np.datetime64
if not np.issubdtype(field_dtype, np.datetime64):
df[date... | def make_date(df:DataFrame, date_field:str):
"Make sure `df[field_name]` is of the right date type."
field_dtype = df[date_field].dtype
if isinstance(field_dtype, pd.core.dtypes.dtypes.DatetimeTZDtype):
field_dtype = np.datetime64
if not np.issubdtype(field_dtype, np.datetime64):
df[date... | [
"Make",
"sure",
"df",
"[",
"field_name",
"]",
"is",
"of",
"the",
"right",
"date",
"type",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/transform.py#L10-L16 | [
"def",
"make_date",
"(",
"df",
":",
"DataFrame",
",",
"date_field",
":",
"str",
")",
":",
"field_dtype",
"=",
"df",
"[",
"date_field",
"]",
".",
"dtype",
"if",
"isinstance",
"(",
"field_dtype",
",",
"pd",
".",
"core",
".",
"dtypes",
".",
"dtypes",
".",... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | cyclic_dt_feat_names | Return feature names of date/time cycles as produced by `cyclic_dt_features`. | fastai/tabular/transform.py | def cyclic_dt_feat_names(time:bool=True, add_linear:bool=False)->List[str]:
"Return feature names of date/time cycles as produced by `cyclic_dt_features`."
fs = ['cos','sin']
attr = [f'{r}_{f}' for r in 'weekday day_month month_year day_year'.split() for f in fs]
if time: attr += [f'{r}_{f}' for r in 'h... | def cyclic_dt_feat_names(time:bool=True, add_linear:bool=False)->List[str]:
"Return feature names of date/time cycles as produced by `cyclic_dt_features`."
fs = ['cos','sin']
attr = [f'{r}_{f}' for r in 'weekday day_month month_year day_year'.split() for f in fs]
if time: attr += [f'{r}_{f}' for r in 'h... | [
"Return",
"feature",
"names",
"of",
"date",
"/",
"time",
"cycles",
"as",
"produced",
"by",
"cyclic_dt_features",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/transform.py#L18-L24 | [
"def",
"cyclic_dt_feat_names",
"(",
"time",
":",
"bool",
"=",
"True",
",",
"add_linear",
":",
"bool",
"=",
"False",
")",
"->",
"List",
"[",
"str",
"]",
":",
"fs",
"=",
"[",
"'cos'",
",",
"'sin'",
"]",
"attr",
"=",
"[",
"f'{r}_{f}'",
"for",
"r",
"in... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | cyclic_dt_features | Calculate the cos and sin of date/time cycles. | fastai/tabular/transform.py | def cyclic_dt_features(d:Union[date,datetime], time:bool=True, add_linear:bool=False)->List[float]:
"Calculate the cos and sin of date/time cycles."
tt,fs = d.timetuple(), [np.cos, np.sin]
day_year,days_month = tt.tm_yday, calendar.monthrange(d.year, d.month)[1]
days_year = 366 if calendar.isleap(d.year... | def cyclic_dt_features(d:Union[date,datetime], time:bool=True, add_linear:bool=False)->List[float]:
"Calculate the cos and sin of date/time cycles."
tt,fs = d.timetuple(), [np.cos, np.sin]
day_year,days_month = tt.tm_yday, calendar.monthrange(d.year, d.month)[1]
days_year = 366 if calendar.isleap(d.year... | [
"Calculate",
"the",
"cos",
"and",
"sin",
"of",
"date",
"/",
"time",
"cycles",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/transform.py#L26-L41 | [
"def",
"cyclic_dt_features",
"(",
"d",
":",
"Union",
"[",
"date",
",",
"datetime",
"]",
",",
"time",
":",
"bool",
"=",
"True",
",",
"add_linear",
":",
"bool",
"=",
"False",
")",
"->",
"List",
"[",
"float",
"]",
":",
"tt",
",",
"fs",
"=",
"d",
"."... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | add_cyclic_datepart | Helper function that adds trigonometric date/time features to a date in the column `field_name` of `df`. | fastai/tabular/transform.py | def add_cyclic_datepart(df:DataFrame, field_name:str, prefix:str=None, drop:bool=True, time:bool=False, add_linear:bool=False):
"Helper function that adds trigonometric date/time features to a date in the column `field_name` of `df`."
make_date(df, field_name)
field = df[field_name]
prefix = ifnone(pref... | def add_cyclic_datepart(df:DataFrame, field_name:str, prefix:str=None, drop:bool=True, time:bool=False, add_linear:bool=False):
"Helper function that adds trigonometric date/time features to a date in the column `field_name` of `df`."
make_date(df, field_name)
field = df[field_name]
prefix = ifnone(pref... | [
"Helper",
"function",
"that",
"adds",
"trigonometric",
"date",
"/",
"time",
"features",
"to",
"a",
"date",
"in",
"the",
"column",
"field_name",
"of",
"df",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/transform.py#L43-L53 | [
"def",
"add_cyclic_datepart",
"(",
"df",
":",
"DataFrame",
",",
"field_name",
":",
"str",
",",
"prefix",
":",
"str",
"=",
"None",
",",
"drop",
":",
"bool",
"=",
"True",
",",
"time",
":",
"bool",
"=",
"False",
",",
"add_linear",
":",
"bool",
"=",
"Fal... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | add_datepart | Helper function that adds columns relevant to a date in the column `field_name` of `df`. | fastai/tabular/transform.py | def add_datepart(df:DataFrame, field_name:str, prefix:str=None, drop:bool=True, time:bool=False):
"Helper function that adds columns relevant to a date in the column `field_name` of `df`."
make_date(df, field_name)
field = df[field_name]
prefix = ifnone(prefix, re.sub('[Dd]ate$', '', field_name))
at... | def add_datepart(df:DataFrame, field_name:str, prefix:str=None, drop:bool=True, time:bool=False):
"Helper function that adds columns relevant to a date in the column `field_name` of `df`."
make_date(df, field_name)
field = df[field_name]
prefix = ifnone(prefix, re.sub('[Dd]ate$', '', field_name))
at... | [
"Helper",
"function",
"that",
"adds",
"columns",
"relevant",
"to",
"a",
"date",
"in",
"the",
"column",
"field_name",
"of",
"df",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/transform.py#L55-L66 | [
"def",
"add_datepart",
"(",
"df",
":",
"DataFrame",
",",
"field_name",
":",
"str",
",",
"prefix",
":",
"str",
"=",
"None",
",",
"drop",
":",
"bool",
"=",
"True",
",",
"time",
":",
"bool",
"=",
"False",
")",
":",
"make_date",
"(",
"df",
",",
"field_... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | cont_cat_split | Helper function that returns column names of cont and cat variables from given df. | fastai/tabular/transform.py | def cont_cat_split(df, max_card=20, dep_var=None)->Tuple[List,List]:
"Helper function that returns column names of cont and cat variables from given df."
cont_names, cat_names = [], []
for label in df:
if label == dep_var: continue
if df[label].dtype == int and df[label].unique().shape[0] > ... | def cont_cat_split(df, max_card=20, dep_var=None)->Tuple[List,List]:
"Helper function that returns column names of cont and cat variables from given df."
cont_names, cat_names = [], []
for label in df:
if label == dep_var: continue
if df[label].dtype == int and df[label].unique().shape[0] > ... | [
"Helper",
"function",
"that",
"returns",
"column",
"names",
"of",
"cont",
"and",
"cat",
"variables",
"from",
"given",
"df",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/transform.py#L106-L113 | [
"def",
"cont_cat_split",
"(",
"df",
",",
"max_card",
"=",
"20",
",",
"dep_var",
"=",
"None",
")",
"->",
"Tuple",
"[",
"List",
",",
"List",
"]",
":",
"cont_names",
",",
"cat_names",
"=",
"[",
"]",
",",
"[",
"]",
"for",
"label",
"in",
"df",
":",
"i... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | Categorify.apply_train | Transform `self.cat_names` columns in categorical. | fastai/tabular/transform.py | def apply_train(self, df:DataFrame):
"Transform `self.cat_names` columns in categorical."
self.categories = {}
for n in self.cat_names:
df.loc[:,n] = df.loc[:,n].astype('category').cat.as_ordered()
self.categories[n] = df[n].cat.categories | def apply_train(self, df:DataFrame):
"Transform `self.cat_names` columns in categorical."
self.categories = {}
for n in self.cat_names:
df.loc[:,n] = df.loc[:,n].astype('category').cat.as_ordered()
self.categories[n] = df[n].cat.categories | [
"Transform",
"self",
".",
"cat_names",
"columns",
"in",
"categorical",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/transform.py#L135-L140 | [
"def",
"apply_train",
"(",
"self",
",",
"df",
":",
"DataFrame",
")",
":",
"self",
".",
"categories",
"=",
"{",
"}",
"for",
"n",
"in",
"self",
".",
"cat_names",
":",
"df",
".",
"loc",
"[",
":",
",",
"n",
"]",
"=",
"df",
".",
"loc",
"[",
":",
"... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | Normalize.apply_train | Compute the means and stds of `self.cont_names` columns to normalize them. | fastai/tabular/transform.py | def apply_train(self, df:DataFrame):
"Compute the means and stds of `self.cont_names` columns to normalize them."
self.means,self.stds = {},{}
for n in self.cont_names:
assert is_numeric_dtype(df[n]), (f"""Cannot normalize '{n}' column as it isn't numerical.
Are you s... | def apply_train(self, df:DataFrame):
"Compute the means and stds of `self.cont_names` columns to normalize them."
self.means,self.stds = {},{}
for n in self.cont_names:
assert is_numeric_dtype(df[n]), (f"""Cannot normalize '{n}' column as it isn't numerical.
Are you s... | [
"Compute",
"the",
"means",
"and",
"stds",
"of",
"self",
".",
"cont_names",
"columns",
"to",
"normalize",
"them",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/transform.py#L183-L190 | [
"def",
"apply_train",
"(",
"self",
",",
"df",
":",
"DataFrame",
")",
":",
"self",
".",
"means",
",",
"self",
".",
"stds",
"=",
"{",
"}",
",",
"{",
"}",
"for",
"n",
"in",
"self",
".",
"cont_names",
":",
"assert",
"is_numeric_dtype",
"(",
"df",
"[",
... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | def_emb_sz | Pick an embedding size for `n` depending on `classes` if not given in `sz_dict`. | fastai/tabular/data.py | def def_emb_sz(classes, n, sz_dict=None):
"Pick an embedding size for `n` depending on `classes` if not given in `sz_dict`."
sz_dict = ifnone(sz_dict, {})
n_cat = len(classes[n])
sz = sz_dict.get(n, int(emb_sz_rule(n_cat))) # rule of thumb
return n_cat,sz | def def_emb_sz(classes, n, sz_dict=None):
"Pick an embedding size for `n` depending on `classes` if not given in `sz_dict`."
sz_dict = ifnone(sz_dict, {})
n_cat = len(classes[n])
sz = sz_dict.get(n, int(emb_sz_rule(n_cat))) # rule of thumb
return n_cat,sz | [
"Pick",
"an",
"embedding",
"size",
"for",
"n",
"depending",
"on",
"classes",
"if",
"not",
"given",
"in",
"sz_dict",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/data.py#L17-L22 | [
"def",
"def_emb_sz",
"(",
"classes",
",",
"n",
",",
"sz_dict",
"=",
"None",
")",
":",
"sz_dict",
"=",
"ifnone",
"(",
"sz_dict",
",",
"{",
"}",
")",
"n_cat",
"=",
"len",
"(",
"classes",
"[",
"n",
"]",
")",
"sz",
"=",
"sz_dict",
".",
"get",
"(",
... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | tabular_learner | Get a `Learner` using `data`, with `metrics`, including a `TabularModel` created using the remaining params. | fastai/tabular/data.py | def tabular_learner(data:DataBunch, layers:Collection[int], emb_szs:Dict[str,int]=None, metrics=None,
ps:Collection[float]=None, emb_drop:float=0., y_range:OptRange=None, use_bn:bool=True, **learn_kwargs):
"Get a `Learner` using `data`, with `metrics`, including a `TabularModel` created using the remaining ... | def tabular_learner(data:DataBunch, layers:Collection[int], emb_szs:Dict[str,int]=None, metrics=None,
ps:Collection[float]=None, emb_drop:float=0., y_range:OptRange=None, use_bn:bool=True, **learn_kwargs):
"Get a `Learner` using `data`, with `metrics`, including a `TabularModel` created using the remaining ... | [
"Get",
"a",
"Learner",
"using",
"data",
"with",
"metrics",
"including",
"a",
"TabularModel",
"created",
"using",
"the",
"remaining",
"params",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/data.py#L170-L176 | [
"def",
"tabular_learner",
"(",
"data",
":",
"DataBunch",
",",
"layers",
":",
"Collection",
"[",
"int",
"]",
",",
"emb_szs",
":",
"Dict",
"[",
"str",
",",
"int",
"]",
"=",
"None",
",",
"metrics",
"=",
"None",
",",
"ps",
":",
"Collection",
"[",
"float"... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | TabularDataBunch.from_df | Create a `DataBunch` from `df` and `valid_idx` with `dep_var`. `kwargs` are passed to `DataBunch.create`. | fastai/tabular/data.py | def from_df(cls, path, df:DataFrame, dep_var:str, valid_idx:Collection[int], procs:OptTabTfms=None,
cat_names:OptStrList=None, cont_names:OptStrList=None, classes:Collection=None,
test_df=None, bs:int=64, val_bs:int=None, num_workers:int=defaults.cpus, dl_tfms:Optional[Collection[Callab... | def from_df(cls, path, df:DataFrame, dep_var:str, valid_idx:Collection[int], procs:OptTabTfms=None,
cat_names:OptStrList=None, cont_names:OptStrList=None, classes:Collection=None,
test_df=None, bs:int=64, val_bs:int=None, num_workers:int=defaults.cpus, dl_tfms:Optional[Collection[Callab... | [
"Create",
"a",
"DataBunch",
"from",
"df",
"and",
"valid_idx",
"with",
"dep_var",
".",
"kwargs",
"are",
"passed",
"to",
"DataBunch",
".",
"create",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/data.py#L87-L101 | [
"def",
"from_df",
"(",
"cls",
",",
"path",
",",
"df",
":",
"DataFrame",
",",
"dep_var",
":",
"str",
",",
"valid_idx",
":",
"Collection",
"[",
"int",
"]",
",",
"procs",
":",
"OptTabTfms",
"=",
"None",
",",
"cat_names",
":",
"OptStrList",
"=",
"None",
... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | TabularList.from_df | Get the list of inputs in the `col` of `path/csv_name`. | fastai/tabular/data.py | def from_df(cls, df:DataFrame, cat_names:OptStrList=None, cont_names:OptStrList=None, procs=None, **kwargs)->'ItemList':
"Get the list of inputs in the `col` of `path/csv_name`."
return cls(items=range(len(df)), cat_names=cat_names, cont_names=cont_names, procs=procs, inner_df=df.copy(), **kwargs) | def from_df(cls, df:DataFrame, cat_names:OptStrList=None, cont_names:OptStrList=None, procs=None, **kwargs)->'ItemList':
"Get the list of inputs in the `col` of `path/csv_name`."
return cls(items=range(len(df)), cat_names=cat_names, cont_names=cont_names, procs=procs, inner_df=df.copy(), **kwargs) | [
"Get",
"the",
"list",
"of",
"inputs",
"in",
"the",
"col",
"of",
"path",
"/",
"csv_name",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/data.py#L119-L121 | [
"def",
"from_df",
"(",
"cls",
",",
"df",
":",
"DataFrame",
",",
"cat_names",
":",
"OptStrList",
"=",
"None",
",",
"cont_names",
":",
"OptStrList",
"=",
"None",
",",
"procs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
"->",
"'ItemList'",
":",
"return",
... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | TabularList.get_emb_szs | Return the default embedding sizes suitable for this data or takes the ones in `sz_dict`. | fastai/tabular/data.py | def get_emb_szs(self, sz_dict=None):
"Return the default embedding sizes suitable for this data or takes the ones in `sz_dict`."
return [def_emb_sz(self.classes, n, sz_dict) for n in self.cat_names] | def get_emb_szs(self, sz_dict=None):
"Return the default embedding sizes suitable for this data or takes the ones in `sz_dict`."
return [def_emb_sz(self.classes, n, sz_dict) for n in self.cat_names] | [
"Return",
"the",
"default",
"embedding",
"sizes",
"suitable",
"for",
"this",
"data",
"or",
"takes",
"the",
"ones",
"in",
"sz_dict",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/data.py#L129-L131 | [
"def",
"get_emb_szs",
"(",
"self",
",",
"sz_dict",
"=",
"None",
")",
":",
"return",
"[",
"def_emb_sz",
"(",
"self",
".",
"classes",
",",
"n",
",",
"sz_dict",
")",
"for",
"n",
"in",
"self",
".",
"cat_names",
"]"
] | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | TabularList.show_xys | Show the `xs` (inputs) and `ys` (targets). | fastai/tabular/data.py | def show_xys(self, xs, ys)->None:
"Show the `xs` (inputs) and `ys` (targets)."
from IPython.display import display, HTML
items,names = [], xs[0].names + ['target']
for i, (x,y) in enumerate(zip(xs,ys)):
res = []
cats = x.cats if len(x.cats.size()) > 0 else []
... | def show_xys(self, xs, ys)->None:
"Show the `xs` (inputs) and `ys` (targets)."
from IPython.display import display, HTML
items,names = [], xs[0].names + ['target']
for i, (x,y) in enumerate(zip(xs,ys)):
res = []
cats = x.cats if len(x.cats.size()) > 0 else []
... | [
"Show",
"the",
"xs",
"(",
"inputs",
")",
"and",
"ys",
"(",
"targets",
")",
"."
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/data.py#L136-L151 | [
"def",
"show_xys",
"(",
"self",
",",
"xs",
",",
"ys",
")",
"->",
"None",
":",
"from",
"IPython",
".",
"display",
"import",
"display",
",",
"HTML",
"items",
",",
"names",
"=",
"[",
"]",
",",
"xs",
"[",
"0",
"]",
".",
"names",
"+",
"[",
"'target'",... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | load_model | Load the classifier and int to string mapping
Args:
itos_filename (str): The filename of the int to string mapping file (usually called itos.pkl)
classifier_filename (str): The filename of the trained classifier
Returns:
string to int mapping, trained classifer model | courses/dl2/imdb_scripts/predict_with_classifier.py | def load_model(itos_filename, classifier_filename, num_classes):
"""Load the classifier and int to string mapping
Args:
itos_filename (str): The filename of the int to string mapping file (usually called itos.pkl)
classifier_filename (str): The filename of the trained classifier
Returns:
... | def load_model(itos_filename, classifier_filename, num_classes):
"""Load the classifier and int to string mapping
Args:
itos_filename (str): The filename of the int to string mapping file (usually called itos.pkl)
classifier_filename (str): The filename of the trained classifier
Returns:
... | [
"Load",
"the",
"classifier",
"and",
"int",
"to",
"string",
"mapping"
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/courses/dl2/imdb_scripts/predict_with_classifier.py#L6-L38 | [
"def",
"load_model",
"(",
"itos_filename",
",",
"classifier_filename",
",",
"num_classes",
")",
":",
"# load the int to string mapping file",
"itos",
"=",
"pickle",
".",
"load",
"(",
"Path",
"(",
"itos_filename",
")",
".",
"open",
"(",
"'rb'",
")",
")",
"# turn ... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | softmax | Numpy Softmax, via comments on https://gist.github.com/stober/1946926
>>> res = softmax(np.array([0, 200, 10]))
>>> np.sum(res)
1.0
>>> np.all(np.abs(res - np.array([0, 1, 0])) < 0.0001)
True
>>> res = softmax(np.array([[0, 200, 10], [0, 10, 200], [200, 0, 10]]))
>>> np.sum(res, axis=1)
... | courses/dl2/imdb_scripts/predict_with_classifier.py | def softmax(x):
'''
Numpy Softmax, via comments on https://gist.github.com/stober/1946926
>>> res = softmax(np.array([0, 200, 10]))
>>> np.sum(res)
1.0
>>> np.all(np.abs(res - np.array([0, 1, 0])) < 0.0001)
True
>>> res = softmax(np.array([[0, 200, 10], [0, 10, 200], [200, 0, 10]]))
... | def softmax(x):
'''
Numpy Softmax, via comments on https://gist.github.com/stober/1946926
>>> res = softmax(np.array([0, 200, 10]))
>>> np.sum(res)
1.0
>>> np.all(np.abs(res - np.array([0, 1, 0])) < 0.0001)
True
>>> res = softmax(np.array([[0, 200, 10], [0, 10, 200], [200, 0, 10]]))
... | [
"Numpy",
"Softmax",
"via",
"comments",
"on",
"https",
":",
"//",
"gist",
".",
"github",
".",
"com",
"/",
"stober",
"/",
"1946926"
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/courses/dl2/imdb_scripts/predict_with_classifier.py#L41-L61 | [
"def",
"softmax",
"(",
"x",
")",
":",
"if",
"x",
".",
"ndim",
"==",
"1",
":",
"x",
"=",
"x",
".",
"reshape",
"(",
"(",
"1",
",",
"-",
"1",
")",
")",
"max_x",
"=",
"np",
".",
"max",
"(",
"x",
",",
"axis",
"=",
"1",
")",
".",
"reshape",
"... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | predict_text | Do the actual prediction on the text using the
model and mapping files passed | courses/dl2/imdb_scripts/predict_with_classifier.py | def predict_text(stoi, model, text):
"""Do the actual prediction on the text using the
model and mapping files passed
"""
# prefix text with tokens:
# xbos: beginning of sentence
# xfld 1: we are using a single field here
input_str = 'xbos xfld 1 ' + text
# predictions are done... | def predict_text(stoi, model, text):
"""Do the actual prediction on the text using the
model and mapping files passed
"""
# prefix text with tokens:
# xbos: beginning of sentence
# xfld 1: we are using a single field here
input_str = 'xbos xfld 1 ' + text
# predictions are done... | [
"Do",
"the",
"actual",
"prediction",
"on",
"the",
"text",
"using",
"the",
"model",
"and",
"mapping",
"files",
"passed"
] | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/courses/dl2/imdb_scripts/predict_with_classifier.py#L64-L100 | [
"def",
"predict_text",
"(",
"stoi",
",",
"model",
",",
"text",
")",
":",
"# prefix text with tokens:",
"# xbos: beginning of sentence",
"# xfld 1: we are using a single field here",
"input_str",
"=",
"'xbos xfld 1 '",
"+",
"text",
"# predictions are done on arrays of input.",... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | predict_input | Loads a model and produces predictions on arbitrary input.
:param itos_filename: the path to the id-to-string mapping file
:param trained_classifier_filename: the filename of the trained classifier;
typically ends with "clas_1.h5"
:param num_classes: the number of cla... | courses/dl2/imdb_scripts/predict_with_classifier.py | def predict_input(itos_filename, trained_classifier_filename, num_classes=2):
"""
Loads a model and produces predictions on arbitrary input.
:param itos_filename: the path to the id-to-string mapping file
:param trained_classifier_filename: the filename of the trained classifier;
... | def predict_input(itos_filename, trained_classifier_filename, num_classes=2):
"""
Loads a model and produces predictions on arbitrary input.
:param itos_filename: the path to the id-to-string mapping file
:param trained_classifier_filename: the filename of the trained classifier;
... | [
"Loads",
"a",
"model",
"and",
"produces",
"predictions",
"on",
"arbitrary",
"input",
".",
":",
"param",
"itos_filename",
":",
"the",
"path",
"to",
"the",
"id",
"-",
"to",
"-",
"string",
"mapping",
"file",
":",
"param",
"trained_classifier_filename",
":",
"th... | fastai/fastai | python | https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/courses/dl2/imdb_scripts/predict_with_classifier.py#L103-L129 | [
"def",
"predict_input",
"(",
"itos_filename",
",",
"trained_classifier_filename",
",",
"num_classes",
"=",
"2",
")",
":",
"# Check the itos file exists",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"itos_filename",
")",
":",
"print",
"(",
"\"Could not find... | 9fb84a5cdefe5a766cdb792b8f5d8971737b7e67 |
train | _make_w3c_caps | Makes a W3C alwaysMatch capabilities object.
Filters out capability names that are not in the W3C spec. Spec-compliant
drivers will reject requests containing unknown capability names.
Moves the Firefox profile, if present, from the old location to the new Firefox
options object.
:Args:
- ca... | py/selenium/webdriver/remote/webdriver.py | def _make_w3c_caps(caps):
"""Makes a W3C alwaysMatch capabilities object.
Filters out capability names that are not in the W3C spec. Spec-compliant
drivers will reject requests containing unknown capability names.
Moves the Firefox profile, if present, from the old location to the new Firefox
opti... | def _make_w3c_caps(caps):
"""Makes a W3C alwaysMatch capabilities object.
Filters out capability names that are not in the W3C spec. Spec-compliant
drivers will reject requests containing unknown capability names.
Moves the Firefox profile, if present, from the old location to the new Firefox
opti... | [
"Makes",
"a",
"W3C",
"alwaysMatch",
"capabilities",
"object",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L65-L95 | [
"def",
"_make_w3c_caps",
"(",
"caps",
")",
":",
"caps",
"=",
"copy",
".",
"deepcopy",
"(",
"caps",
")",
"profile",
"=",
"caps",
".",
"get",
"(",
"'firefox_profile'",
")",
"always_match",
"=",
"{",
"}",
"if",
"caps",
".",
"get",
"(",
"'proxy'",
")",
"... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.file_detector_context | Overrides the current file detector (if necessary) in limited context.
Ensures the original file detector is set afterwards.
Example:
with webdriver.file_detector_context(UselessFileDetector):
someinput.send_keys('/etc/hosts')
:Args:
- file_detector_class - Class ... | py/selenium/webdriver/remote/webdriver.py | def file_detector_context(self, file_detector_class, *args, **kwargs):
"""
Overrides the current file detector (if necessary) in limited context.
Ensures the original file detector is set afterwards.
Example:
with webdriver.file_detector_context(UselessFileDetector):
... | def file_detector_context(self, file_detector_class, *args, **kwargs):
"""
Overrides the current file detector (if necessary) in limited context.
Ensures the original file detector is set afterwards.
Example:
with webdriver.file_detector_context(UselessFileDetector):
... | [
"Overrides",
"the",
"current",
"file",
"detector",
"(",
"if",
"necessary",
")",
"in",
"limited",
"context",
".",
"Ensures",
"the",
"original",
"file",
"detector",
"is",
"set",
"afterwards",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L168-L194 | [
"def",
"file_detector_context",
"(",
"self",
",",
"file_detector_class",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"last_detector",
"=",
"None",
"if",
"not",
"isinstance",
"(",
"self",
".",
"file_detector",
",",
"file_detector_class",
")",
":",
"l... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.start_session | Creates a new session with the desired capabilities.
:Args:
- browser_name - The name of the browser to request.
- version - Which browser version to request.
- platform - Which platform to request the browser on.
- javascript_enabled - Whether the new session should support... | py/selenium/webdriver/remote/webdriver.py | def start_session(self, capabilities, browser_profile=None):
"""
Creates a new session with the desired capabilities.
:Args:
- browser_name - The name of the browser to request.
- version - Which browser version to request.
- platform - Which platform to request the b... | def start_session(self, capabilities, browser_profile=None):
"""
Creates a new session with the desired capabilities.
:Args:
- browser_name - The name of the browser to request.
- version - Which browser version to request.
- platform - Which platform to request the b... | [
"Creates",
"a",
"new",
"session",
"with",
"the",
"desired",
"capabilities",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L228-L262 | [
"def",
"start_session",
"(",
"self",
",",
"capabilities",
",",
"browser_profile",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"capabilities",
",",
"dict",
")",
":",
"raise",
"InvalidArgumentException",
"(",
"\"Capabilities must be a dictionary\"",
")",
... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.create_web_element | Creates a web element with the specified `element_id`. | py/selenium/webdriver/remote/webdriver.py | def create_web_element(self, element_id):
"""Creates a web element with the specified `element_id`."""
return self._web_element_cls(self, element_id, w3c=self.w3c) | def create_web_element(self, element_id):
"""Creates a web element with the specified `element_id`."""
return self._web_element_cls(self, element_id, w3c=self.w3c) | [
"Creates",
"a",
"web",
"element",
"with",
"the",
"specified",
"element_id",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L277-L279 | [
"def",
"create_web_element",
"(",
"self",
",",
"element_id",
")",
":",
"return",
"self",
".",
"_web_element_cls",
"(",
"self",
",",
"element_id",
",",
"w3c",
"=",
"self",
".",
"w3c",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.execute | Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
The command's JSON response loaded into a dictionary object. | py/selenium/webdriver/remote/webdriver.py | def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
... | def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
... | [
"Sends",
"a",
"command",
"to",
"be",
"executed",
"by",
"a",
"command",
".",
"CommandExecutor",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L298-L324 | [
"def",
"execute",
"(",
"self",
",",
"driver_command",
",",
"params",
"=",
"None",
")",
":",
"if",
"self",
".",
"session_id",
"is",
"not",
"None",
":",
"if",
"not",
"params",
":",
"params",
"=",
"{",
"'sessionId'",
":",
"self",
".",
"session_id",
"}",
... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.find_element_by_id | Finds an element by id.
:Args:
- id\\_ - The id of the element to be found.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found
:Usage:
::
element = driver.find_el... | py/selenium/webdriver/remote/webdriver.py | def find_element_by_id(self, id_):
"""Finds an element by id.
:Args:
- id\\_ - The id of the element to be found.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found
:Usage:
... | def find_element_by_id(self, id_):
"""Finds an element by id.
:Args:
- id\\_ - The id of the element to be found.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found
:Usage:
... | [
"Finds",
"an",
"element",
"by",
"id",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L344-L361 | [
"def",
"find_element_by_id",
"(",
"self",
",",
"id_",
")",
":",
"return",
"self",
".",
"find_element",
"(",
"by",
"=",
"By",
".",
"ID",
",",
"value",
"=",
"id_",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.find_elements_by_id | Finds multiple elements by id.
:Args:
- id\\_ - The id of the elements to be found.
:Returns:
- list of WebElement - a list with elements if any was found. An
empty list if not
:Usage:
::
elements = driver.find_elements_by_id('foo') | py/selenium/webdriver/remote/webdriver.py | def find_elements_by_id(self, id_):
"""
Finds multiple elements by id.
:Args:
- id\\_ - The id of the elements to be found.
:Returns:
- list of WebElement - a list with elements if any was found. An
empty list if not
:Usage:
::
... | def find_elements_by_id(self, id_):
"""
Finds multiple elements by id.
:Args:
- id\\_ - The id of the elements to be found.
:Returns:
- list of WebElement - a list with elements if any was found. An
empty list if not
:Usage:
::
... | [
"Finds",
"multiple",
"elements",
"by",
"id",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L363-L379 | [
"def",
"find_elements_by_id",
"(",
"self",
",",
"id_",
")",
":",
"return",
"self",
".",
"find_elements",
"(",
"by",
"=",
"By",
".",
"ID",
",",
"value",
"=",
"id_",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.find_element_by_xpath | Finds an element by xpath.
:Args:
- xpath - The xpath locator of the element to find.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found
:Usage:
::
element = driv... | py/selenium/webdriver/remote/webdriver.py | def find_element_by_xpath(self, xpath):
"""
Finds an element by xpath.
:Args:
- xpath - The xpath locator of the element to find.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found
... | def find_element_by_xpath(self, xpath):
"""
Finds an element by xpath.
:Args:
- xpath - The xpath locator of the element to find.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found
... | [
"Finds",
"an",
"element",
"by",
"xpath",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L381-L399 | [
"def",
"find_element_by_xpath",
"(",
"self",
",",
"xpath",
")",
":",
"return",
"self",
".",
"find_element",
"(",
"by",
"=",
"By",
".",
"XPATH",
",",
"value",
"=",
"xpath",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.find_elements_by_xpath | Finds multiple elements by xpath.
:Args:
- xpath - The xpath locator of the elements to be found.
:Returns:
- list of WebElement - a list with elements if any was found. An
empty list if not
:Usage:
::
elements = driver.find_elements_... | py/selenium/webdriver/remote/webdriver.py | def find_elements_by_xpath(self, xpath):
"""
Finds multiple elements by xpath.
:Args:
- xpath - The xpath locator of the elements to be found.
:Returns:
- list of WebElement - a list with elements if any was found. An
empty list if not
:Usage:
... | def find_elements_by_xpath(self, xpath):
"""
Finds multiple elements by xpath.
:Args:
- xpath - The xpath locator of the elements to be found.
:Returns:
- list of WebElement - a list with elements if any was found. An
empty list if not
:Usage:
... | [
"Finds",
"multiple",
"elements",
"by",
"xpath",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L401-L417 | [
"def",
"find_elements_by_xpath",
"(",
"self",
",",
"xpath",
")",
":",
"return",
"self",
".",
"find_elements",
"(",
"by",
"=",
"By",
".",
"XPATH",
",",
"value",
"=",
"xpath",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.find_element_by_link_text | Finds an element by link text.
:Args:
- link_text: The text of the element to be found.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found
:Usage:
::
element = dr... | py/selenium/webdriver/remote/webdriver.py | def find_element_by_link_text(self, link_text):
"""
Finds an element by link text.
:Args:
- link_text: The text of the element to be found.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't... | def find_element_by_link_text(self, link_text):
"""
Finds an element by link text.
:Args:
- link_text: The text of the element to be found.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't... | [
"Finds",
"an",
"element",
"by",
"link",
"text",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L419-L437 | [
"def",
"find_element_by_link_text",
"(",
"self",
",",
"link_text",
")",
":",
"return",
"self",
".",
"find_element",
"(",
"by",
"=",
"By",
".",
"LINK_TEXT",
",",
"value",
"=",
"link_text",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.find_elements_by_link_text | Finds elements by link text.
:Args:
- link_text: The text of the elements to be found.
:Returns:
- list of webelement - a list with elements if any was found. an
empty list if not
:Usage:
::
elements = driver.find_elements_by_link_tex... | py/selenium/webdriver/remote/webdriver.py | def find_elements_by_link_text(self, text):
"""
Finds elements by link text.
:Args:
- link_text: The text of the elements to be found.
:Returns:
- list of webelement - a list with elements if any was found. an
empty list if not
:Usage:
... | def find_elements_by_link_text(self, text):
"""
Finds elements by link text.
:Args:
- link_text: The text of the elements to be found.
:Returns:
- list of webelement - a list with elements if any was found. an
empty list if not
:Usage:
... | [
"Finds",
"elements",
"by",
"link",
"text",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L439-L455 | [
"def",
"find_elements_by_link_text",
"(",
"self",
",",
"text",
")",
":",
"return",
"self",
".",
"find_elements",
"(",
"by",
"=",
"By",
".",
"LINK_TEXT",
",",
"value",
"=",
"text",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.find_element_by_partial_link_text | Finds an element by a partial match of its link text.
:Args:
- link_text: The text of the element to partially match on.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found
:Usage:
... | py/selenium/webdriver/remote/webdriver.py | def find_element_by_partial_link_text(self, link_text):
"""
Finds an element by a partial match of its link text.
:Args:
- link_text: The text of the element to partially match on.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuc... | def find_element_by_partial_link_text(self, link_text):
"""
Finds an element by a partial match of its link text.
:Args:
- link_text: The text of the element to partially match on.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuc... | [
"Finds",
"an",
"element",
"by",
"a",
"partial",
"match",
"of",
"its",
"link",
"text",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L457-L475 | [
"def",
"find_element_by_partial_link_text",
"(",
"self",
",",
"link_text",
")",
":",
"return",
"self",
".",
"find_element",
"(",
"by",
"=",
"By",
".",
"PARTIAL_LINK_TEXT",
",",
"value",
"=",
"link_text",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.find_elements_by_partial_link_text | Finds elements by a partial match of their link text.
:Args:
- link_text: The text of the element to partial match on.
:Returns:
- list of webelement - a list with elements if any was found. an
empty list if not
:Usage:
::
elements = ... | py/selenium/webdriver/remote/webdriver.py | def find_elements_by_partial_link_text(self, link_text):
"""
Finds elements by a partial match of their link text.
:Args:
- link_text: The text of the element to partial match on.
:Returns:
- list of webelement - a list with elements if any was found. an
e... | def find_elements_by_partial_link_text(self, link_text):
"""
Finds elements by a partial match of their link text.
:Args:
- link_text: The text of the element to partial match on.
:Returns:
- list of webelement - a list with elements if any was found. an
e... | [
"Finds",
"elements",
"by",
"a",
"partial",
"match",
"of",
"their",
"link",
"text",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L477-L493 | [
"def",
"find_elements_by_partial_link_text",
"(",
"self",
",",
"link_text",
")",
":",
"return",
"self",
".",
"find_elements",
"(",
"by",
"=",
"By",
".",
"PARTIAL_LINK_TEXT",
",",
"value",
"=",
"link_text",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.find_element_by_name | Finds an element by name.
:Args:
- name: The name of the element to find.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found
:Usage:
::
element = driver.find_elem... | py/selenium/webdriver/remote/webdriver.py | def find_element_by_name(self, name):
"""
Finds an element by name.
:Args:
- name: The name of the element to find.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found
:Usage:
... | def find_element_by_name(self, name):
"""
Finds an element by name.
:Args:
- name: The name of the element to find.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found
:Usage:
... | [
"Finds",
"an",
"element",
"by",
"name",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L495-L513 | [
"def",
"find_element_by_name",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"find_element",
"(",
"by",
"=",
"By",
".",
"NAME",
",",
"value",
"=",
"name",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.find_elements_by_name | Finds elements by name.
:Args:
- name: The name of the elements to find.
:Returns:
- list of webelement - a list with elements if any was found. an
empty list if not
:Usage:
::
elements = driver.find_elements_by_name('foo') | py/selenium/webdriver/remote/webdriver.py | def find_elements_by_name(self, name):
"""
Finds elements by name.
:Args:
- name: The name of the elements to find.
:Returns:
- list of webelement - a list with elements if any was found. an
empty list if not
:Usage:
::
... | def find_elements_by_name(self, name):
"""
Finds elements by name.
:Args:
- name: The name of the elements to find.
:Returns:
- list of webelement - a list with elements if any was found. an
empty list if not
:Usage:
::
... | [
"Finds",
"elements",
"by",
"name",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L515-L531 | [
"def",
"find_elements_by_name",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"find_elements",
"(",
"by",
"=",
"By",
".",
"NAME",
",",
"value",
"=",
"name",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.find_element_by_tag_name | Finds an element by tag name.
:Args:
- name - name of html tag (eg: h1, a, span)
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found
:Usage:
::
element = driver.fi... | py/selenium/webdriver/remote/webdriver.py | def find_element_by_tag_name(self, name):
"""
Finds an element by tag name.
:Args:
- name - name of html tag (eg: h1, a, span)
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found
... | def find_element_by_tag_name(self, name):
"""
Finds an element by tag name.
:Args:
- name - name of html tag (eg: h1, a, span)
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found
... | [
"Finds",
"an",
"element",
"by",
"tag",
"name",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L533-L551 | [
"def",
"find_element_by_tag_name",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"find_element",
"(",
"by",
"=",
"By",
".",
"TAG_NAME",
",",
"value",
"=",
"name",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.find_elements_by_tag_name | Finds elements by tag name.
:Args:
- name - name of html tag (eg: h1, a, span)
:Returns:
- list of WebElement - a list with elements if any was found. An
empty list if not
:Usage:
::
elements = driver.find_elements_by_tag_name('h1') | py/selenium/webdriver/remote/webdriver.py | def find_elements_by_tag_name(self, name):
"""
Finds elements by tag name.
:Args:
- name - name of html tag (eg: h1, a, span)
:Returns:
- list of WebElement - a list with elements if any was found. An
empty list if not
:Usage:
::
... | def find_elements_by_tag_name(self, name):
"""
Finds elements by tag name.
:Args:
- name - name of html tag (eg: h1, a, span)
:Returns:
- list of WebElement - a list with elements if any was found. An
empty list if not
:Usage:
::
... | [
"Finds",
"elements",
"by",
"tag",
"name",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L553-L569 | [
"def",
"find_elements_by_tag_name",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"find_elements",
"(",
"by",
"=",
"By",
".",
"TAG_NAME",
",",
"value",
"=",
"name",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.find_element_by_class_name | Finds an element by class name.
:Args:
- name: The class name of the element to find.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found
:Usage:
::
element = driv... | py/selenium/webdriver/remote/webdriver.py | def find_element_by_class_name(self, name):
"""
Finds an element by class name.
:Args:
- name: The class name of the element to find.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found... | def find_element_by_class_name(self, name):
"""
Finds an element by class name.
:Args:
- name: The class name of the element to find.
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found... | [
"Finds",
"an",
"element",
"by",
"class",
"name",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L571-L589 | [
"def",
"find_element_by_class_name",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"find_element",
"(",
"by",
"=",
"By",
".",
"CLASS_NAME",
",",
"value",
"=",
"name",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.find_elements_by_class_name | Finds elements by class name.
:Args:
- name: The class name of the elements to find.
:Returns:
- list of WebElement - a list with elements if any was found. An
empty list if not
:Usage:
::
elements = driver.find_elements_by_class_name... | py/selenium/webdriver/remote/webdriver.py | def find_elements_by_class_name(self, name):
"""
Finds elements by class name.
:Args:
- name: The class name of the elements to find.
:Returns:
- list of WebElement - a list with elements if any was found. An
empty list if not
:Usage:
... | def find_elements_by_class_name(self, name):
"""
Finds elements by class name.
:Args:
- name: The class name of the elements to find.
:Returns:
- list of WebElement - a list with elements if any was found. An
empty list if not
:Usage:
... | [
"Finds",
"elements",
"by",
"class",
"name",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L591-L607 | [
"def",
"find_elements_by_class_name",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"find_elements",
"(",
"by",
"=",
"By",
".",
"CLASS_NAME",
",",
"value",
"=",
"name",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.find_element_by_css_selector | Finds an element by css selector.
:Args:
- css_selector - CSS selector string, ex: 'a.nav#home'
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the element wasn't found
:Usage:
::
elem... | py/selenium/webdriver/remote/webdriver.py | def find_element_by_css_selector(self, css_selector):
"""
Finds an element by css selector.
:Args:
- css_selector - CSS selector string, ex: 'a.nav#home'
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the ... | def find_element_by_css_selector(self, css_selector):
"""
Finds an element by css selector.
:Args:
- css_selector - CSS selector string, ex: 'a.nav#home'
:Returns:
- WebElement - the element if it was found
:Raises:
- NoSuchElementException - if the ... | [
"Finds",
"an",
"element",
"by",
"css",
"selector",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L609-L627 | [
"def",
"find_element_by_css_selector",
"(",
"self",
",",
"css_selector",
")",
":",
"return",
"self",
".",
"find_element",
"(",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"value",
"=",
"css_selector",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.find_elements_by_css_selector | Finds elements by css selector.
:Args:
- css_selector - CSS selector string, ex: 'a.nav#home'
:Returns:
- list of WebElement - a list with elements if any was found. An
empty list if not
:Usage:
::
elements = driver.find_elements_by_c... | py/selenium/webdriver/remote/webdriver.py | def find_elements_by_css_selector(self, css_selector):
"""
Finds elements by css selector.
:Args:
- css_selector - CSS selector string, ex: 'a.nav#home'
:Returns:
- list of WebElement - a list with elements if any was found. An
empty list if not
:... | def find_elements_by_css_selector(self, css_selector):
"""
Finds elements by css selector.
:Args:
- css_selector - CSS selector string, ex: 'a.nav#home'
:Returns:
- list of WebElement - a list with elements if any was found. An
empty list if not
:... | [
"Finds",
"elements",
"by",
"css",
"selector",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L629-L645 | [
"def",
"find_elements_by_css_selector",
"(",
"self",
",",
"css_selector",
")",
":",
"return",
"self",
".",
"find_elements",
"(",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"value",
"=",
"css_selector",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.execute_script | Synchronously Executes JavaScript in the current window/frame.
:Args:
- script: The JavaScript to execute.
- \\*args: Any applicable arguments for your JavaScript.
:Usage:
::
driver.execute_script('return document.title;') | py/selenium/webdriver/remote/webdriver.py | def execute_script(self, script, *args):
"""
Synchronously Executes JavaScript in the current window/frame.
:Args:
- script: The JavaScript to execute.
- \\*args: Any applicable arguments for your JavaScript.
:Usage:
::
driver.execute_scri... | def execute_script(self, script, *args):
"""
Synchronously Executes JavaScript in the current window/frame.
:Args:
- script: The JavaScript to execute.
- \\*args: Any applicable arguments for your JavaScript.
:Usage:
::
driver.execute_scri... | [
"Synchronously",
"Executes",
"JavaScript",
"in",
"the",
"current",
"window",
"/",
"frame",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L647-L669 | [
"def",
"execute_script",
"(",
"self",
",",
"script",
",",
"*",
"args",
")",
":",
"converted_args",
"=",
"list",
"(",
"args",
")",
"command",
"=",
"None",
"if",
"self",
".",
"w3c",
":",
"command",
"=",
"Command",
".",
"W3C_EXECUTE_SCRIPT",
"else",
":",
... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.execute_async_script | Asynchronously Executes JavaScript in the current window/frame.
:Args:
- script: The JavaScript to execute.
- \\*args: Any applicable arguments for your JavaScript.
:Usage:
::
script = "var callback = arguments[arguments.length - 1]; " \\
... | py/selenium/webdriver/remote/webdriver.py | def execute_async_script(self, script, *args):
"""
Asynchronously Executes JavaScript in the current window/frame.
:Args:
- script: The JavaScript to execute.
- \\*args: Any applicable arguments for your JavaScript.
:Usage:
::
script = "va... | def execute_async_script(self, script, *args):
"""
Asynchronously Executes JavaScript in the current window/frame.
:Args:
- script: The JavaScript to execute.
- \\*args: Any applicable arguments for your JavaScript.
:Usage:
::
script = "va... | [
"Asynchronously",
"Executes",
"JavaScript",
"in",
"the",
"current",
"window",
"/",
"frame",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L671-L694 | [
"def",
"execute_async_script",
"(",
"self",
",",
"script",
",",
"*",
"args",
")",
":",
"converted_args",
"=",
"list",
"(",
"args",
")",
"if",
"self",
".",
"w3c",
":",
"command",
"=",
"Command",
".",
"W3C_EXECUTE_SCRIPT_ASYNC",
"else",
":",
"command",
"=",
... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.quit | Quits the driver and closes every associated window.
:Usage:
::
driver.quit() | py/selenium/webdriver/remote/webdriver.py | def quit(self):
"""
Quits the driver and closes every associated window.
:Usage:
::
driver.quit()
"""
try:
self.execute(Command.QUIT)
finally:
self.stop_client()
self.command_executor.close() | def quit(self):
"""
Quits the driver and closes every associated window.
:Usage:
::
driver.quit()
"""
try:
self.execute(Command.QUIT)
finally:
self.stop_client()
self.command_executor.close() | [
"Quits",
"the",
"driver",
"and",
"closes",
"every",
"associated",
"window",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L731-L744 | [
"def",
"quit",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"execute",
"(",
"Command",
".",
"QUIT",
")",
"finally",
":",
"self",
".",
"stop_client",
"(",
")",
"self",
".",
"command_executor",
".",
"close",
"(",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.current_window_handle | Returns the handle of the current window.
:Usage:
::
driver.current_window_handle | py/selenium/webdriver/remote/webdriver.py | def current_window_handle(self):
"""
Returns the handle of the current window.
:Usage:
::
driver.current_window_handle
"""
if self.w3c:
return self.execute(Command.W3C_GET_CURRENT_WINDOW_HANDLE)['value']
else:
return s... | def current_window_handle(self):
"""
Returns the handle of the current window.
:Usage:
::
driver.current_window_handle
"""
if self.w3c:
return self.execute(Command.W3C_GET_CURRENT_WINDOW_HANDLE)['value']
else:
return s... | [
"Returns",
"the",
"handle",
"of",
"the",
"current",
"window",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L747-L759 | [
"def",
"current_window_handle",
"(",
"self",
")",
":",
"if",
"self",
".",
"w3c",
":",
"return",
"self",
".",
"execute",
"(",
"Command",
".",
"W3C_GET_CURRENT_WINDOW_HANDLE",
")",
"[",
"'value'",
"]",
"else",
":",
"return",
"self",
".",
"execute",
"(",
"Com... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.window_handles | Returns the handles of all windows within the current session.
:Usage:
::
driver.window_handles | py/selenium/webdriver/remote/webdriver.py | def window_handles(self):
"""
Returns the handles of all windows within the current session.
:Usage:
::
driver.window_handles
"""
if self.w3c:
return self.execute(Command.W3C_GET_WINDOW_HANDLES)['value']
else:
return s... | def window_handles(self):
"""
Returns the handles of all windows within the current session.
:Usage:
::
driver.window_handles
"""
if self.w3c:
return self.execute(Command.W3C_GET_WINDOW_HANDLES)['value']
else:
return s... | [
"Returns",
"the",
"handles",
"of",
"all",
"windows",
"within",
"the",
"current",
"session",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L762-L774 | [
"def",
"window_handles",
"(",
"self",
")",
":",
"if",
"self",
".",
"w3c",
":",
"return",
"self",
".",
"execute",
"(",
"Command",
".",
"W3C_GET_WINDOW_HANDLES",
")",
"[",
"'value'",
"]",
"else",
":",
"return",
"self",
".",
"execute",
"(",
"Command",
".",
... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.maximize_window | Maximizes the current window that webdriver is using | py/selenium/webdriver/remote/webdriver.py | def maximize_window(self):
"""
Maximizes the current window that webdriver is using
"""
params = None
command = Command.W3C_MAXIMIZE_WINDOW
if not self.w3c:
command = Command.MAXIMIZE_WINDOW
params = {'windowHandle': 'current'}
self.execute... | def maximize_window(self):
"""
Maximizes the current window that webdriver is using
"""
params = None
command = Command.W3C_MAXIMIZE_WINDOW
if not self.w3c:
command = Command.MAXIMIZE_WINDOW
params = {'windowHandle': 'current'}
self.execute... | [
"Maximizes",
"the",
"current",
"window",
"that",
"webdriver",
"is",
"using"
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L776-L785 | [
"def",
"maximize_window",
"(",
"self",
")",
":",
"params",
"=",
"None",
"command",
"=",
"Command",
".",
"W3C_MAXIMIZE_WINDOW",
"if",
"not",
"self",
".",
"w3c",
":",
"command",
"=",
"Command",
".",
"MAXIMIZE_WINDOW",
"params",
"=",
"{",
"'windowHandle'",
":",... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.get_cookie | Get a single cookie by name. Returns the cookie if found, None if not.
:Usage:
::
driver.get_cookie('my_cookie') | py/selenium/webdriver/remote/webdriver.py | def get_cookie(self, name):
"""
Get a single cookie by name. Returns the cookie if found, None if not.
:Usage:
::
driver.get_cookie('my_cookie')
"""
if self.w3c:
try:
return self.execute(Command.GET_COOKIE, {'name': name})... | def get_cookie(self, name):
"""
Get a single cookie by name. Returns the cookie if found, None if not.
:Usage:
::
driver.get_cookie('my_cookie')
"""
if self.w3c:
try:
return self.execute(Command.GET_COOKIE, {'name': name})... | [
"Get",
"a",
"single",
"cookie",
"by",
"name",
".",
"Returns",
"the",
"cookie",
"if",
"found",
"None",
"if",
"not",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L865-L884 | [
"def",
"get_cookie",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"w3c",
":",
"try",
":",
"return",
"self",
".",
"execute",
"(",
"Command",
".",
"GET_COOKIE",
",",
"{",
"'name'",
":",
"name",
"}",
")",
"[",
"'value'",
"]",
"except",
"NoSu... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.implicitly_wait | Sets a sticky timeout to implicitly wait for an element to be found,
or a command to complete. This method only needs to be called one
time per session. To set the timeout for calls to
execute_async_script, see set_script_timeout.
:Args:
- time_to_wait: Amount of time ... | py/selenium/webdriver/remote/webdriver.py | def implicitly_wait(self, time_to_wait):
"""
Sets a sticky timeout to implicitly wait for an element to be found,
or a command to complete. This method only needs to be called one
time per session. To set the timeout for calls to
execute_async_script, see set_script_time... | def implicitly_wait(self, time_to_wait):
"""
Sets a sticky timeout to implicitly wait for an element to be found,
or a command to complete. This method only needs to be called one
time per session. To set the timeout for calls to
execute_async_script, see set_script_time... | [
"Sets",
"a",
"sticky",
"timeout",
"to",
"implicitly",
"wait",
"for",
"an",
"element",
"to",
"be",
"found",
"or",
"a",
"command",
"to",
"complete",
".",
"This",
"method",
"only",
"needs",
"to",
"be",
"called",
"one",
"time",
"per",
"session",
".",
"To",
... | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L925-L945 | [
"def",
"implicitly_wait",
"(",
"self",
",",
"time_to_wait",
")",
":",
"if",
"self",
".",
"w3c",
":",
"self",
".",
"execute",
"(",
"Command",
".",
"SET_TIMEOUTS",
",",
"{",
"'implicit'",
":",
"int",
"(",
"float",
"(",
"time_to_wait",
")",
"*",
"1000",
"... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.set_script_timeout | Set the amount of time that the script should wait during an
execute_async_script call before throwing an error.
:Args:
- time_to_wait: The amount of time to wait (in seconds)
:Usage:
::
driver.set_script_timeout(30) | py/selenium/webdriver/remote/webdriver.py | def set_script_timeout(self, time_to_wait):
"""
Set the amount of time that the script should wait during an
execute_async_script call before throwing an error.
:Args:
- time_to_wait: The amount of time to wait (in seconds)
:Usage:
::
dr... | def set_script_timeout(self, time_to_wait):
"""
Set the amount of time that the script should wait during an
execute_async_script call before throwing an error.
:Args:
- time_to_wait: The amount of time to wait (in seconds)
:Usage:
::
dr... | [
"Set",
"the",
"amount",
"of",
"time",
"that",
"the",
"script",
"should",
"wait",
"during",
"an",
"execute_async_script",
"call",
"before",
"throwing",
"an",
"error",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L947-L965 | [
"def",
"set_script_timeout",
"(",
"self",
",",
"time_to_wait",
")",
":",
"if",
"self",
".",
"w3c",
":",
"self",
".",
"execute",
"(",
"Command",
".",
"SET_TIMEOUTS",
",",
"{",
"'script'",
":",
"int",
"(",
"float",
"(",
"time_to_wait",
")",
"*",
"1000",
... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.set_page_load_timeout | Set the amount of time to wait for a page load to complete
before throwing an error.
:Args:
- time_to_wait: The amount of time to wait
:Usage:
::
driver.set_page_load_timeout(30) | py/selenium/webdriver/remote/webdriver.py | def set_page_load_timeout(self, time_to_wait):
"""
Set the amount of time to wait for a page load to complete
before throwing an error.
:Args:
- time_to_wait: The amount of time to wait
:Usage:
::
driver.set_page_load_timeout(30)
... | def set_page_load_timeout(self, time_to_wait):
"""
Set the amount of time to wait for a page load to complete
before throwing an error.
:Args:
- time_to_wait: The amount of time to wait
:Usage:
::
driver.set_page_load_timeout(30)
... | [
"Set",
"the",
"amount",
"of",
"time",
"to",
"wait",
"for",
"a",
"page",
"load",
"to",
"complete",
"before",
"throwing",
"an",
"error",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L967-L986 | [
"def",
"set_page_load_timeout",
"(",
"self",
",",
"time_to_wait",
")",
":",
"try",
":",
"self",
".",
"execute",
"(",
"Command",
".",
"SET_TIMEOUTS",
",",
"{",
"'pageLoad'",
":",
"int",
"(",
"float",
"(",
"time_to_wait",
")",
"*",
"1000",
")",
"}",
")",
... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.find_element | Find an element given a By strategy and locator. Prefer the find_element_by_* methods when
possible.
:Usage:
::
element = driver.find_element(By.ID, 'foo')
:rtype: WebElement | py/selenium/webdriver/remote/webdriver.py | def find_element(self, by=By.ID, value=None):
"""
Find an element given a By strategy and locator. Prefer the find_element_by_* methods when
possible.
:Usage:
::
element = driver.find_element(By.ID, 'foo')
:rtype: WebElement
"""
if s... | def find_element(self, by=By.ID, value=None):
"""
Find an element given a By strategy and locator. Prefer the find_element_by_* methods when
possible.
:Usage:
::
element = driver.find_element(By.ID, 'foo')
:rtype: WebElement
"""
if s... | [
"Find",
"an",
"element",
"given",
"a",
"By",
"strategy",
"and",
"locator",
".",
"Prefer",
"the",
"find_element_by_",
"*",
"methods",
"when",
"possible",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L988-L1014 | [
"def",
"find_element",
"(",
"self",
",",
"by",
"=",
"By",
".",
"ID",
",",
"value",
"=",
"None",
")",
":",
"if",
"self",
".",
"w3c",
":",
"if",
"by",
"==",
"By",
".",
"ID",
":",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
"value",
"=",
"'[id=\"%s\"]'",
... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.find_elements | Find elements given a By strategy and locator. Prefer the find_elements_by_* methods when
possible.
:Usage:
::
elements = driver.find_elements(By.CLASS_NAME, 'foo')
:rtype: list of WebElement | py/selenium/webdriver/remote/webdriver.py | def find_elements(self, by=By.ID, value=None):
"""
Find elements given a By strategy and locator. Prefer the find_elements_by_* methods when
possible.
:Usage:
::
elements = driver.find_elements(By.CLASS_NAME, 'foo')
:rtype: list of WebElement
... | def find_elements(self, by=By.ID, value=None):
"""
Find elements given a By strategy and locator. Prefer the find_elements_by_* methods when
possible.
:Usage:
::
elements = driver.find_elements(By.CLASS_NAME, 'foo')
:rtype: list of WebElement
... | [
"Find",
"elements",
"given",
"a",
"By",
"strategy",
"and",
"locator",
".",
"Prefer",
"the",
"find_elements_by_",
"*",
"methods",
"when",
"possible",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L1016-L1045 | [
"def",
"find_elements",
"(",
"self",
",",
"by",
"=",
"By",
".",
"ID",
",",
"value",
"=",
"None",
")",
":",
"if",
"self",
".",
"w3c",
":",
"if",
"by",
"==",
"By",
".",
"ID",
":",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
"value",
"=",
"'[id=\"%s\"]'",... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.get_screenshot_as_file | Saves a screenshot of the current window to a PNG image file. Returns
False if there is any IOError, else returns True. Use full paths in
your filename.
:Args:
- filename: The full path you wish to save your screenshot to. This
should end with a `.png` extension.
... | py/selenium/webdriver/remote/webdriver.py | def get_screenshot_as_file(self, filename):
"""
Saves a screenshot of the current window to a PNG image file. Returns
False if there is any IOError, else returns True. Use full paths in
your filename.
:Args:
- filename: The full path you wish to save your screensh... | def get_screenshot_as_file(self, filename):
"""
Saves a screenshot of the current window to a PNG image file. Returns
False if there is any IOError, else returns True. Use full paths in
your filename.
:Args:
- filename: The full path you wish to save your screensh... | [
"Saves",
"a",
"screenshot",
"of",
"the",
"current",
"window",
"to",
"a",
"PNG",
"image",
"file",
".",
"Returns",
"False",
"if",
"there",
"is",
"any",
"IOError",
"else",
"returns",
"True",
".",
"Use",
"full",
"paths",
"in",
"your",
"filename",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L1054-L1080 | [
"def",
"get_screenshot_as_file",
"(",
"self",
",",
"filename",
")",
":",
"if",
"not",
"filename",
".",
"lower",
"(",
")",
".",
"endswith",
"(",
"'.png'",
")",
":",
"warnings",
".",
"warn",
"(",
"\"name used for saved screenshot does not match file \"",
"\"type. It... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.set_window_size | Sets the width and height of the current window. (window.resizeTo)
:Args:
- width: the width in pixels to set the window to
- height: the height in pixels to set the window to
:Usage:
::
driver.set_window_size(800,600) | py/selenium/webdriver/remote/webdriver.py | def set_window_size(self, width, height, windowHandle='current'):
"""
Sets the width and height of the current window. (window.resizeTo)
:Args:
- width: the width in pixels to set the window to
- height: the height in pixels to set the window to
:Usage:
::... | def set_window_size(self, width, height, windowHandle='current'):
"""
Sets the width and height of the current window. (window.resizeTo)
:Args:
- width: the width in pixels to set the window to
- height: the height in pixels to set the window to
:Usage:
::... | [
"Sets",
"the",
"width",
"and",
"height",
"of",
"the",
"current",
"window",
".",
"(",
"window",
".",
"resizeTo",
")"
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L1122-L1143 | [
"def",
"set_window_size",
"(",
"self",
",",
"width",
",",
"height",
",",
"windowHandle",
"=",
"'current'",
")",
":",
"if",
"self",
".",
"w3c",
":",
"if",
"windowHandle",
"!=",
"'current'",
":",
"warnings",
".",
"warn",
"(",
"\"Only 'current' window is supporte... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.get_window_size | Gets the width and height of the current window.
:Usage:
::
driver.get_window_size() | py/selenium/webdriver/remote/webdriver.py | def get_window_size(self, windowHandle='current'):
"""
Gets the width and height of the current window.
:Usage:
::
driver.get_window_size()
"""
command = Command.GET_WINDOW_SIZE
if self.w3c:
if windowHandle != 'current':
... | def get_window_size(self, windowHandle='current'):
"""
Gets the width and height of the current window.
:Usage:
::
driver.get_window_size()
"""
command = Command.GET_WINDOW_SIZE
if self.w3c:
if windowHandle != 'current':
... | [
"Gets",
"the",
"width",
"and",
"height",
"of",
"the",
"current",
"window",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L1145-L1165 | [
"def",
"get_window_size",
"(",
"self",
",",
"windowHandle",
"=",
"'current'",
")",
":",
"command",
"=",
"Command",
".",
"GET_WINDOW_SIZE",
"if",
"self",
".",
"w3c",
":",
"if",
"windowHandle",
"!=",
"'current'",
":",
"warnings",
".",
"warn",
"(",
"\"Only 'cur... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.set_window_position | Sets the x,y position of the current window. (window.moveTo)
:Args:
- x: the x-coordinate in pixels to set the window position
- y: the y-coordinate in pixels to set the window position
:Usage:
::
driver.set_window_position(0,0) | py/selenium/webdriver/remote/webdriver.py | def set_window_position(self, x, y, windowHandle='current'):
"""
Sets the x,y position of the current window. (window.moveTo)
:Args:
- x: the x-coordinate in pixels to set the window position
- y: the y-coordinate in pixels to set the window position
:Usage:
... | def set_window_position(self, x, y, windowHandle='current'):
"""
Sets the x,y position of the current window. (window.moveTo)
:Args:
- x: the x-coordinate in pixels to set the window position
- y: the y-coordinate in pixels to set the window position
:Usage:
... | [
"Sets",
"the",
"x",
"y",
"position",
"of",
"the",
"current",
"window",
".",
"(",
"window",
".",
"moveTo",
")"
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L1167-L1190 | [
"def",
"set_window_position",
"(",
"self",
",",
"x",
",",
"y",
",",
"windowHandle",
"=",
"'current'",
")",
":",
"if",
"self",
".",
"w3c",
":",
"if",
"windowHandle",
"!=",
"'current'",
":",
"warnings",
".",
"warn",
"(",
"\"Only 'current' window is supported for... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.get_window_position | Gets the x,y position of the current window.
:Usage:
::
driver.get_window_position() | py/selenium/webdriver/remote/webdriver.py | def get_window_position(self, windowHandle='current'):
"""
Gets the x,y position of the current window.
:Usage:
::
driver.get_window_position()
"""
if self.w3c:
if windowHandle != 'current':
warnings.warn("Only 'current' w... | def get_window_position(self, windowHandle='current'):
"""
Gets the x,y position of the current window.
:Usage:
::
driver.get_window_position()
"""
if self.w3c:
if windowHandle != 'current':
warnings.warn("Only 'current' w... | [
"Gets",
"the",
"x",
"y",
"position",
"of",
"the",
"current",
"window",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L1192-L1209 | [
"def",
"get_window_position",
"(",
"self",
",",
"windowHandle",
"=",
"'current'",
")",
":",
"if",
"self",
".",
"w3c",
":",
"if",
"windowHandle",
"!=",
"'current'",
":",
"warnings",
".",
"warn",
"(",
"\"Only 'current' window is supported for W3C compatibile browsers.\"... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.set_window_rect | Sets the x, y coordinates of the window as well as height and width of
the current window. This method is only supported for W3C compatible
browsers; other browsers should use `set_window_position` and
`set_window_size`.
:Usage:
::
driver.set_window_rect(x=1... | py/selenium/webdriver/remote/webdriver.py | def set_window_rect(self, x=None, y=None, width=None, height=None):
"""
Sets the x, y coordinates of the window as well as height and width of
the current window. This method is only supported for W3C compatible
browsers; other browsers should use `set_window_position` and
`set_w... | def set_window_rect(self, x=None, y=None, width=None, height=None):
"""
Sets the x, y coordinates of the window as well as height and width of
the current window. This method is only supported for W3C compatible
browsers; other browsers should use `set_window_position` and
`set_w... | [
"Sets",
"the",
"x",
"y",
"coordinates",
"of",
"the",
"window",
"as",
"well",
"as",
"height",
"and",
"width",
"of",
"the",
"current",
"window",
".",
"This",
"method",
"is",
"only",
"supported",
"for",
"W3C",
"compatible",
"browsers",
";",
"other",
"browsers... | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L1223-L1245 | [
"def",
"set_window_rect",
"(",
"self",
",",
"x",
"=",
"None",
",",
"y",
"=",
"None",
",",
"width",
"=",
"None",
",",
"height",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"w3c",
":",
"raise",
"UnknownMethodException",
"(",
"\"set_window_rect is only... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.file_detector | Set the file detector to be used when sending keyboard input.
By default, this is set to a file detector that does nothing.
see FileDetector
see LocalFileDetector
see UselessFileDetector
:Args:
- detector: The detector to use. Must not be None. | py/selenium/webdriver/remote/webdriver.py | def file_detector(self, detector):
"""
Set the file detector to be used when sending keyboard input.
By default, this is set to a file detector that does nothing.
see FileDetector
see LocalFileDetector
see UselessFileDetector
:Args:
- detector: The dete... | def file_detector(self, detector):
"""
Set the file detector to be used when sending keyboard input.
By default, this is set to a file detector that does nothing.
see FileDetector
see LocalFileDetector
see UselessFileDetector
:Args:
- detector: The dete... | [
"Set",
"the",
"file",
"detector",
"to",
"be",
"used",
"when",
"sending",
"keyboard",
"input",
".",
"By",
"default",
"this",
"is",
"set",
"to",
"a",
"file",
"detector",
"that",
"does",
"nothing",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L1252-L1268 | [
"def",
"file_detector",
"(",
"self",
",",
"detector",
")",
":",
"if",
"detector",
"is",
"None",
":",
"raise",
"WebDriverException",
"(",
"\"You may not set a file detector that is null\"",
")",
"if",
"not",
"isinstance",
"(",
"detector",
",",
"FileDetector",
")",
... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.orientation | Sets the current orientation of the device
:Args:
- value: orientation to set it to.
:Usage:
::
driver.orientation = 'landscape' | py/selenium/webdriver/remote/webdriver.py | def orientation(self, value):
"""
Sets the current orientation of the device
:Args:
- value: orientation to set it to.
:Usage:
::
driver.orientation = 'landscape'
"""
allowed_values = ['LANDSCAPE', 'PORTRAIT']
if value.upper... | def orientation(self, value):
"""
Sets the current orientation of the device
:Args:
- value: orientation to set it to.
:Usage:
::
driver.orientation = 'landscape'
"""
allowed_values = ['LANDSCAPE', 'PORTRAIT']
if value.upper... | [
"Sets",
"the",
"current",
"orientation",
"of",
"the",
"device"
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L1283-L1299 | [
"def",
"orientation",
"(",
"self",
",",
"value",
")",
":",
"allowed_values",
"=",
"[",
"'LANDSCAPE'",
",",
"'PORTRAIT'",
"]",
"if",
"value",
".",
"upper",
"(",
")",
"in",
"allowed_values",
":",
"self",
".",
"execute",
"(",
"Command",
".",
"SET_SCREEN_ORIEN... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | ErrorHandler.check_response | Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message. | py/selenium/webdriver/remote/errorhandler.py | def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
... | def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
... | [
"Checks",
"that",
"a",
"JSON",
"response",
"from",
"the",
"WebDriver",
"does",
"not",
"have",
"an",
"error",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/errorhandler.py#L102-L236 | [
"def",
"check_response",
"(",
"self",
",",
"response",
")",
":",
"status",
"=",
"response",
".",
"get",
"(",
"'status'",
",",
"None",
")",
"if",
"status",
"is",
"None",
"or",
"status",
"==",
"ErrorCode",
".",
"SUCCESS",
":",
"return",
"value",
"=",
"No... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriverWait.until | Calls the method provided with the driver as an argument until the \
return value does not evaluate to ``False``.
:param method: callable(WebDriver)
:param message: optional message for :exc:`TimeoutException`
:returns: the result of the last call to `method`
:raises: :exc:`sele... | py/selenium/webdriver/support/wait.py | def until(self, method, message=''):
"""Calls the method provided with the driver as an argument until the \
return value does not evaluate to ``False``.
:param method: callable(WebDriver)
:param message: optional message for :exc:`TimeoutException`
:returns: the result of the l... | def until(self, method, message=''):
"""Calls the method provided with the driver as an argument until the \
return value does not evaluate to ``False``.
:param method: callable(WebDriver)
:param message: optional message for :exc:`TimeoutException`
:returns: the result of the l... | [
"Calls",
"the",
"method",
"provided",
"with",
"the",
"driver",
"as",
"an",
"argument",
"until",
"the",
"\\",
"return",
"value",
"does",
"not",
"evaluate",
"to",
"False",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/support/wait.py#L62-L86 | [
"def",
"until",
"(",
"self",
",",
"method",
",",
"message",
"=",
"''",
")",
":",
"screen",
"=",
"None",
"stacktrace",
"=",
"None",
"end_time",
"=",
"time",
".",
"time",
"(",
")",
"+",
"self",
".",
"_timeout",
"while",
"True",
":",
"try",
":",
"valu... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriverWait.until_not | Calls the method provided with the driver as an argument until the \
return value evaluates to ``False``.
:param method: callable(WebDriver)
:param message: optional message for :exc:`TimeoutException`
:returns: the result of the last call to `method`, or
``True`` if `... | py/selenium/webdriver/support/wait.py | def until_not(self, method, message=''):
"""Calls the method provided with the driver as an argument until the \
return value evaluates to ``False``.
:param method: callable(WebDriver)
:param message: optional message for :exc:`TimeoutException`
:returns: the result of the last ... | def until_not(self, method, message=''):
"""Calls the method provided with the driver as an argument until the \
return value evaluates to ``False``.
:param method: callable(WebDriver)
:param message: optional message for :exc:`TimeoutException`
:returns: the result of the last ... | [
"Calls",
"the",
"method",
"provided",
"with",
"the",
"driver",
"as",
"an",
"argument",
"until",
"the",
"\\",
"return",
"value",
"evaluates",
"to",
"False",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/support/wait.py#L88-L109 | [
"def",
"until_not",
"(",
"self",
",",
"method",
",",
"message",
"=",
"''",
")",
":",
"end_time",
"=",
"time",
".",
"time",
"(",
")",
"+",
"self",
".",
"_timeout",
"while",
"True",
":",
"try",
":",
"value",
"=",
"method",
"(",
"self",
".",
"_driver"... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.quit | Quits the driver and close every associated window. | py/selenium/webdriver/firefox/webdriver.py | def quit(self):
"""Quits the driver and close every associated window."""
try:
RemoteWebDriver.quit(self)
except Exception:
# We don't care about the message because something probably has gone wrong
pass
if self.w3c:
self.service.stop()
... | def quit(self):
"""Quits the driver and close every associated window."""
try:
RemoteWebDriver.quit(self)
except Exception:
# We don't care about the message because something probably has gone wrong
pass
if self.w3c:
self.service.stop()
... | [
"Quits",
"the",
"driver",
"and",
"close",
"every",
"associated",
"window",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/firefox/webdriver.py#L178-L197 | [
"def",
"quit",
"(",
"self",
")",
":",
"try",
":",
"RemoteWebDriver",
".",
"quit",
"(",
"self",
")",
"except",
"Exception",
":",
"# We don't care about the message because something probably has gone wrong",
"pass",
"if",
"self",
".",
"w3c",
":",
"self",
".",
"serv... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.context | Sets the context that Selenium commands are running in using
a `with` statement. The state of the context on the server is
saved before entering the block, and restored upon exiting it.
:param context: Context, may be one of the class properties
`CONTEXT_CHROME` or `CONTEXT_CONTENT`... | py/selenium/webdriver/firefox/webdriver.py | def context(self, context):
"""Sets the context that Selenium commands are running in using
a `with` statement. The state of the context on the server is
saved before entering the block, and restored upon exiting it.
:param context: Context, may be one of the class properties
... | def context(self, context):
"""Sets the context that Selenium commands are running in using
a `with` statement. The state of the context on the server is
saved before entering the block, and restored upon exiting it.
:param context: Context, may be one of the class properties
... | [
"Sets",
"the",
"context",
"that",
"Selenium",
"commands",
"are",
"running",
"in",
"using",
"a",
"with",
"statement",
".",
"The",
"state",
"of",
"the",
"context",
"on",
"the",
"server",
"is",
"saved",
"before",
"entering",
"the",
"block",
"and",
"restored",
... | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/firefox/webdriver.py#L209-L228 | [
"def",
"context",
"(",
"self",
",",
"context",
")",
":",
"initial_context",
"=",
"self",
".",
"execute",
"(",
"'GET_CONTEXT'",
")",
".",
"pop",
"(",
"'value'",
")",
"self",
".",
"set_context",
"(",
"context",
")",
"try",
":",
"yield",
"finally",
":",
"... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | WebDriver.install_addon | Installs Firefox addon.
Returns identifier of installed addon. This identifier can later
be used to uninstall addon.
:param path: Absolute path to the addon that will be installed.
:Usage:
::
driver.install_addon('/path/to/firebug.xpi') | py/selenium/webdriver/firefox/webdriver.py | def install_addon(self, path, temporary=None):
"""
Installs Firefox addon.
Returns identifier of installed addon. This identifier can later
be used to uninstall addon.
:param path: Absolute path to the addon that will be installed.
:Usage:
::
... | def install_addon(self, path, temporary=None):
"""
Installs Firefox addon.
Returns identifier of installed addon. This identifier can later
be used to uninstall addon.
:param path: Absolute path to the addon that will be installed.
:Usage:
::
... | [
"Installs",
"Firefox",
"addon",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/firefox/webdriver.py#L230-L247 | [
"def",
"install_addon",
"(",
"self",
",",
"path",
",",
"temporary",
"=",
"None",
")",
":",
"payload",
"=",
"{",
"\"path\"",
":",
"path",
"}",
"if",
"temporary",
"is",
"not",
"None",
":",
"payload",
"[",
"\"temporary\"",
"]",
"=",
"temporary",
"return",
... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | Options.binary | Sets location of the browser binary, either by string or
``FirefoxBinary`` instance. | py/selenium/webdriver/firefox/options.py | def binary(self, new_binary):
"""Sets location of the browser binary, either by string or
``FirefoxBinary`` instance.
"""
if not isinstance(new_binary, FirefoxBinary):
new_binary = FirefoxBinary(new_binary)
self._binary = new_binary | def binary(self, new_binary):
"""Sets location of the browser binary, either by string or
``FirefoxBinary`` instance.
"""
if not isinstance(new_binary, FirefoxBinary):
new_binary = FirefoxBinary(new_binary)
self._binary = new_binary | [
"Sets",
"location",
"of",
"the",
"browser",
"binary",
"either",
"by",
"string",
"or",
"FirefoxBinary",
"instance",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/firefox/options.py#L52-L59 | [
"def",
"binary",
"(",
"self",
",",
"new_binary",
")",
":",
"if",
"not",
"isinstance",
"(",
"new_binary",
",",
"FirefoxBinary",
")",
":",
"new_binary",
"=",
"FirefoxBinary",
"(",
"new_binary",
")",
"self",
".",
"_binary",
"=",
"new_binary"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | Options.profile | Sets location of the browser profile to use, either by string
or ``FirefoxProfile``. | py/selenium/webdriver/firefox/options.py | def profile(self, new_profile):
"""Sets location of the browser profile to use, either by string
or ``FirefoxProfile``.
"""
if not isinstance(new_profile, FirefoxProfile):
new_profile = FirefoxProfile(new_profile)
self._profile = new_profile | def profile(self, new_profile):
"""Sets location of the browser profile to use, either by string
or ``FirefoxProfile``.
"""
if not isinstance(new_profile, FirefoxProfile):
new_profile = FirefoxProfile(new_profile)
self._profile = new_profile | [
"Sets",
"location",
"of",
"the",
"browser",
"profile",
"to",
"use",
"either",
"by",
"string",
"or",
"FirefoxProfile",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/firefox/options.py#L111-L118 | [
"def",
"profile",
"(",
"self",
",",
"new_profile",
")",
":",
"if",
"not",
"isinstance",
"(",
"new_profile",
",",
"FirefoxProfile",
")",
":",
"new_profile",
"=",
"FirefoxProfile",
"(",
"new_profile",
")",
"self",
".",
"_profile",
"=",
"new_profile"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | Options.headless | Sets the headless argument
Args:
value: boolean value indicating to set the headless option | py/selenium/webdriver/firefox/options.py | def headless(self, value):
"""
Sets the headless argument
Args:
value: boolean value indicating to set the headless option
"""
if value is True:
self._arguments.append('-headless')
elif '-headless' in self._arguments:
self._arguments.rem... | def headless(self, value):
"""
Sets the headless argument
Args:
value: boolean value indicating to set the headless option
"""
if value is True:
self._arguments.append('-headless')
elif '-headless' in self._arguments:
self._arguments.rem... | [
"Sets",
"the",
"headless",
"argument"
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/firefox/options.py#L128-L138 | [
"def",
"headless",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"is",
"True",
":",
"self",
".",
"_arguments",
".",
"append",
"(",
"'-headless'",
")",
"elif",
"'-headless'",
"in",
"self",
".",
"_arguments",
":",
"self",
".",
"_arguments",
".",
"r... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | Options.to_capabilities | Marshals the Firefox options to a `moz:firefoxOptions`
object. | py/selenium/webdriver/firefox/options.py | def to_capabilities(self):
"""Marshals the Firefox options to a `moz:firefoxOptions`
object.
"""
# This intentionally looks at the internal properties
# so if a binary or profile has _not_ been set,
# it will defer to geckodriver to find the system Firefox
# and g... | def to_capabilities(self):
"""Marshals the Firefox options to a `moz:firefoxOptions`
object.
"""
# This intentionally looks at the internal properties
# so if a binary or profile has _not_ been set,
# it will defer to geckodriver to find the system Firefox
# and g... | [
"Marshals",
"the",
"Firefox",
"options",
"to",
"a",
"moz",
":",
"firefoxOptions",
"object",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/firefox/options.py#L140-L167 | [
"def",
"to_capabilities",
"(",
"self",
")",
":",
"# This intentionally looks at the internal properties",
"# so if a binary or profile has _not_ been set,",
"# it will defer to geckodriver to find the system Firefox",
"# and generate a fresh profile.",
"caps",
"=",
"self",
".",
"_caps",
... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | Mobile.set_network_connection | Set the network connection for the remote device.
Example of setting airplane mode::
driver.mobile.set_network_connection(driver.mobile.AIRPLANE_MODE) | py/selenium/webdriver/remote/mobile.py | def set_network_connection(self, network):
"""
Set the network connection for the remote device.
Example of setting airplane mode::
driver.mobile.set_network_connection(driver.mobile.AIRPLANE_MODE)
"""
mode = network.mask if isinstance(network, self.ConnectionType) ... | def set_network_connection(self, network):
"""
Set the network connection for the remote device.
Example of setting airplane mode::
driver.mobile.set_network_connection(driver.mobile.AIRPLANE_MODE)
"""
mode = network.mask if isinstance(network, self.ConnectionType) ... | [
"Set",
"the",
"network",
"connection",
"for",
"the",
"remote",
"device",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/mobile.py#L52-L64 | [
"def",
"set_network_connection",
"(",
"self",
",",
"network",
")",
":",
"mode",
"=",
"network",
".",
"mask",
"if",
"isinstance",
"(",
"network",
",",
"self",
".",
"ConnectionType",
")",
"else",
"network",
"return",
"self",
".",
"ConnectionType",
"(",
"self",... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | unzip_to_temp_dir | Unzip zipfile to a temporary directory.
The directory of the unzipped files is returned if success,
otherwise None is returned. | py/selenium/webdriver/remote/utils.py | def unzip_to_temp_dir(zip_file_name):
"""Unzip zipfile to a temporary directory.
The directory of the unzipped files is returned if success,
otherwise None is returned. """
if not zip_file_name or not os.path.exists(zip_file_name):
return None
zf = zipfile.ZipFile(zip_file_name)
if zf... | def unzip_to_temp_dir(zip_file_name):
"""Unzip zipfile to a temporary directory.
The directory of the unzipped files is returned if success,
otherwise None is returned. """
if not zip_file_name or not os.path.exists(zip_file_name):
return None
zf = zipfile.ZipFile(zip_file_name)
if zf... | [
"Unzip",
"zipfile",
"to",
"a",
"temporary",
"directory",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/utils.py#L40-L90 | [
"def",
"unzip_to_temp_dir",
"(",
"zip_file_name",
")",
":",
"if",
"not",
"zip_file_name",
"or",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"zip_file_name",
")",
":",
"return",
"None",
"zf",
"=",
"zipfile",
".",
"ZipFile",
"(",
"zip_file_name",
")",
"if"... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | TouchActions.tap | Taps on a given element.
:Args:
- on_element: The element to tap. | py/selenium/webdriver/common/touch_actions.py | def tap(self, on_element):
"""
Taps on a given element.
:Args:
- on_element: The element to tap.
"""
self._actions.append(lambda: self._driver.execute(
Command.SINGLE_TAP, {'element': on_element.id}))
return self | def tap(self, on_element):
"""
Taps on a given element.
:Args:
- on_element: The element to tap.
"""
self._actions.append(lambda: self._driver.execute(
Command.SINGLE_TAP, {'element': on_element.id}))
return self | [
"Taps",
"on",
"a",
"given",
"element",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/common/touch_actions.py#L49-L58 | [
"def",
"tap",
"(",
"self",
",",
"on_element",
")",
":",
"self",
".",
"_actions",
".",
"append",
"(",
"lambda",
":",
"self",
".",
"_driver",
".",
"execute",
"(",
"Command",
".",
"SINGLE_TAP",
",",
"{",
"'element'",
":",
"on_element",
".",
"id",
"}",
"... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | TouchActions.double_tap | Double taps on a given element.
:Args:
- on_element: The element to tap. | py/selenium/webdriver/common/touch_actions.py | def double_tap(self, on_element):
"""
Double taps on a given element.
:Args:
- on_element: The element to tap.
"""
self._actions.append(lambda: self._driver.execute(
Command.DOUBLE_TAP, {'element': on_element.id}))
return self | def double_tap(self, on_element):
"""
Double taps on a given element.
:Args:
- on_element: The element to tap.
"""
self._actions.append(lambda: self._driver.execute(
Command.DOUBLE_TAP, {'element': on_element.id}))
return self | [
"Double",
"taps",
"on",
"a",
"given",
"element",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/common/touch_actions.py#L60-L69 | [
"def",
"double_tap",
"(",
"self",
",",
"on_element",
")",
":",
"self",
".",
"_actions",
".",
"append",
"(",
"lambda",
":",
"self",
".",
"_driver",
".",
"execute",
"(",
"Command",
".",
"DOUBLE_TAP",
",",
"{",
"'element'",
":",
"on_element",
".",
"id",
"... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | TouchActions.tap_and_hold | Touch down at given coordinates.
:Args:
- xcoord: X Coordinate to touch down.
- ycoord: Y Coordinate to touch down. | py/selenium/webdriver/common/touch_actions.py | def tap_and_hold(self, xcoord, ycoord):
"""
Touch down at given coordinates.
:Args:
- xcoord: X Coordinate to touch down.
- ycoord: Y Coordinate to touch down.
"""
self._actions.append(lambda: self._driver.execute(
Command.TOUCH_DOWN, {
... | def tap_and_hold(self, xcoord, ycoord):
"""
Touch down at given coordinates.
:Args:
- xcoord: X Coordinate to touch down.
- ycoord: Y Coordinate to touch down.
"""
self._actions.append(lambda: self._driver.execute(
Command.TOUCH_DOWN, {
... | [
"Touch",
"down",
"at",
"given",
"coordinates",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/common/touch_actions.py#L71-L83 | [
"def",
"tap_and_hold",
"(",
"self",
",",
"xcoord",
",",
"ycoord",
")",
":",
"self",
".",
"_actions",
".",
"append",
"(",
"lambda",
":",
"self",
".",
"_driver",
".",
"execute",
"(",
"Command",
".",
"TOUCH_DOWN",
",",
"{",
"'x'",
":",
"int",
"(",
"xcoo... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | TouchActions.move | Move held tap to specified location.
:Args:
- xcoord: X Coordinate to move.
- ycoord: Y Coordinate to move. | py/selenium/webdriver/common/touch_actions.py | def move(self, xcoord, ycoord):
"""
Move held tap to specified location.
:Args:
- xcoord: X Coordinate to move.
- ycoord: Y Coordinate to move.
"""
self._actions.append(lambda: self._driver.execute(
Command.TOUCH_MOVE, {
'x': int(xco... | def move(self, xcoord, ycoord):
"""
Move held tap to specified location.
:Args:
- xcoord: X Coordinate to move.
- ycoord: Y Coordinate to move.
"""
self._actions.append(lambda: self._driver.execute(
Command.TOUCH_MOVE, {
'x': int(xco... | [
"Move",
"held",
"tap",
"to",
"specified",
"location",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/common/touch_actions.py#L85-L97 | [
"def",
"move",
"(",
"self",
",",
"xcoord",
",",
"ycoord",
")",
":",
"self",
".",
"_actions",
".",
"append",
"(",
"lambda",
":",
"self",
".",
"_driver",
".",
"execute",
"(",
"Command",
".",
"TOUCH_MOVE",
",",
"{",
"'x'",
":",
"int",
"(",
"xcoord",
"... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | TouchActions.release | Release previously issued tap 'and hold' command at specified location.
:Args:
- xcoord: X Coordinate to release.
- ycoord: Y Coordinate to release. | py/selenium/webdriver/common/touch_actions.py | def release(self, xcoord, ycoord):
"""
Release previously issued tap 'and hold' command at specified location.
:Args:
- xcoord: X Coordinate to release.
- ycoord: Y Coordinate to release.
"""
self._actions.append(lambda: self._driver.execute(
Comman... | def release(self, xcoord, ycoord):
"""
Release previously issued tap 'and hold' command at specified location.
:Args:
- xcoord: X Coordinate to release.
- ycoord: Y Coordinate to release.
"""
self._actions.append(lambda: self._driver.execute(
Comman... | [
"Release",
"previously",
"issued",
"tap",
"and",
"hold",
"command",
"at",
"specified",
"location",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/common/touch_actions.py#L99-L111 | [
"def",
"release",
"(",
"self",
",",
"xcoord",
",",
"ycoord",
")",
":",
"self",
".",
"_actions",
".",
"append",
"(",
"lambda",
":",
"self",
".",
"_driver",
".",
"execute",
"(",
"Command",
".",
"TOUCH_UP",
",",
"{",
"'x'",
":",
"int",
"(",
"xcoord",
... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | TouchActions.scroll | Touch and scroll, moving by xoffset and yoffset.
:Args:
- xoffset: X offset to scroll to.
- yoffset: Y offset to scroll to. | py/selenium/webdriver/common/touch_actions.py | def scroll(self, xoffset, yoffset):
"""
Touch and scroll, moving by xoffset and yoffset.
:Args:
- xoffset: X offset to scroll to.
- yoffset: Y offset to scroll to.
"""
self._actions.append(lambda: self._driver.execute(
Command.TOUCH_SCROLL, {
... | def scroll(self, xoffset, yoffset):
"""
Touch and scroll, moving by xoffset and yoffset.
:Args:
- xoffset: X offset to scroll to.
- yoffset: Y offset to scroll to.
"""
self._actions.append(lambda: self._driver.execute(
Command.TOUCH_SCROLL, {
... | [
"Touch",
"and",
"scroll",
"moving",
"by",
"xoffset",
"and",
"yoffset",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/common/touch_actions.py#L113-L125 | [
"def",
"scroll",
"(",
"self",
",",
"xoffset",
",",
"yoffset",
")",
":",
"self",
".",
"_actions",
".",
"append",
"(",
"lambda",
":",
"self",
".",
"_driver",
".",
"execute",
"(",
"Command",
".",
"TOUCH_SCROLL",
",",
"{",
"'xoffset'",
":",
"int",
"(",
"... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | TouchActions.scroll_from_element | Touch and scroll starting at on_element, moving by xoffset and yoffset.
:Args:
- on_element: The element where scroll starts.
- xoffset: X offset to scroll to.
- yoffset: Y offset to scroll to. | py/selenium/webdriver/common/touch_actions.py | def scroll_from_element(self, on_element, xoffset, yoffset):
"""
Touch and scroll starting at on_element, moving by xoffset and yoffset.
:Args:
- on_element: The element where scroll starts.
- xoffset: X offset to scroll to.
- yoffset: Y offset to scroll to.
"... | def scroll_from_element(self, on_element, xoffset, yoffset):
"""
Touch and scroll starting at on_element, moving by xoffset and yoffset.
:Args:
- on_element: The element where scroll starts.
- xoffset: X offset to scroll to.
- yoffset: Y offset to scroll to.
"... | [
"Touch",
"and",
"scroll",
"starting",
"at",
"on_element",
"moving",
"by",
"xoffset",
"and",
"yoffset",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/common/touch_actions.py#L127-L141 | [
"def",
"scroll_from_element",
"(",
"self",
",",
"on_element",
",",
"xoffset",
",",
"yoffset",
")",
":",
"self",
".",
"_actions",
".",
"append",
"(",
"lambda",
":",
"self",
".",
"_driver",
".",
"execute",
"(",
"Command",
".",
"TOUCH_SCROLL",
",",
"{",
"'e... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | TouchActions.long_press | Long press on an element.
:Args:
- on_element: The element to long press. | py/selenium/webdriver/common/touch_actions.py | def long_press(self, on_element):
"""
Long press on an element.
:Args:
- on_element: The element to long press.
"""
self._actions.append(lambda: self._driver.execute(
Command.LONG_PRESS, {'element': on_element.id}))
return self | def long_press(self, on_element):
"""
Long press on an element.
:Args:
- on_element: The element to long press.
"""
self._actions.append(lambda: self._driver.execute(
Command.LONG_PRESS, {'element': on_element.id}))
return self | [
"Long",
"press",
"on",
"an",
"element",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/common/touch_actions.py#L143-L152 | [
"def",
"long_press",
"(",
"self",
",",
"on_element",
")",
":",
"self",
".",
"_actions",
".",
"append",
"(",
"lambda",
":",
"self",
".",
"_driver",
".",
"execute",
"(",
"Command",
".",
"LONG_PRESS",
",",
"{",
"'element'",
":",
"on_element",
".",
"id",
"... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | TouchActions.flick | Flicks, starting anywhere on the screen.
:Args:
- xspeed: The X speed in pixels per second.
- yspeed: The Y speed in pixels per second. | py/selenium/webdriver/common/touch_actions.py | def flick(self, xspeed, yspeed):
"""
Flicks, starting anywhere on the screen.
:Args:
- xspeed: The X speed in pixels per second.
- yspeed: The Y speed in pixels per second.
"""
self._actions.append(lambda: self._driver.execute(
Command.FLICK, {
... | def flick(self, xspeed, yspeed):
"""
Flicks, starting anywhere on the screen.
:Args:
- xspeed: The X speed in pixels per second.
- yspeed: The Y speed in pixels per second.
"""
self._actions.append(lambda: self._driver.execute(
Command.FLICK, {
... | [
"Flicks",
"starting",
"anywhere",
"on",
"the",
"screen",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/common/touch_actions.py#L154-L166 | [
"def",
"flick",
"(",
"self",
",",
"xspeed",
",",
"yspeed",
")",
":",
"self",
".",
"_actions",
".",
"append",
"(",
"lambda",
":",
"self",
".",
"_driver",
".",
"execute",
"(",
"Command",
".",
"FLICK",
",",
"{",
"'xspeed'",
":",
"int",
"(",
"xspeed",
... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | TouchActions.flick_element | Flick starting at on_element, and moving by the xoffset and yoffset
with specified speed.
:Args:
- on_element: Flick will start at center of element.
- xoffset: X offset to flick to.
- yoffset: Y offset to flick to.
- speed: Pixels per second to flick. | py/selenium/webdriver/common/touch_actions.py | def flick_element(self, on_element, xoffset, yoffset, speed):
"""
Flick starting at on_element, and moving by the xoffset and yoffset
with specified speed.
:Args:
- on_element: Flick will start at center of element.
- xoffset: X offset to flick to.
- yoffset: ... | def flick_element(self, on_element, xoffset, yoffset, speed):
"""
Flick starting at on_element, and moving by the xoffset and yoffset
with specified speed.
:Args:
- on_element: Flick will start at center of element.
- xoffset: X offset to flick to.
- yoffset: ... | [
"Flick",
"starting",
"at",
"on_element",
"and",
"moving",
"by",
"the",
"xoffset",
"and",
"yoffset",
"with",
"specified",
"speed",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/common/touch_actions.py#L168-L185 | [
"def",
"flick_element",
"(",
"self",
",",
"on_element",
",",
"xoffset",
",",
"yoffset",
",",
"speed",
")",
":",
"self",
".",
"_actions",
".",
"append",
"(",
"lambda",
":",
"self",
".",
"_driver",
".",
"execute",
"(",
"Command",
".",
"FLICK",
",",
"{",
... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | Options.to_capabilities | Creates a capabilities with all the options that have been set and
returns a dictionary with everything | py/selenium/webdriver/webkitgtk/options.py | def to_capabilities(self):
"""
Creates a capabilities with all the options that have been set and
returns a dictionary with everything
"""
caps = self._caps
browser_options = {}
if self.binary_location:
browser_options["binary"] = self.binary_location... | def to_capabilities(self):
"""
Creates a capabilities with all the options that have been set and
returns a dictionary with everything
"""
caps = self._caps
browser_options = {}
if self.binary_location:
browser_options["binary"] = self.binary_location... | [
"Creates",
"a",
"capabilities",
"with",
"all",
"the",
"options",
"that",
"have",
"been",
"set",
"and",
"returns",
"a",
"dictionary",
"with",
"everything"
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/webkitgtk/options.py#L64-L80 | [
"def",
"to_capabilities",
"(",
"self",
")",
":",
"caps",
"=",
"self",
".",
"_caps",
"browser_options",
"=",
"{",
"}",
"if",
"self",
".",
"binary_location",
":",
"browser_options",
"[",
"\"binary\"",
"]",
"=",
"self",
".",
"binary_location",
"if",
"self",
"... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | SwitchTo.active_element | Returns the element with focus, or BODY if nothing has focus.
:Usage:
::
element = driver.switch_to.active_element | py/selenium/webdriver/remote/switch_to.py | def active_element(self):
"""
Returns the element with focus, or BODY if nothing has focus.
:Usage:
::
element = driver.switch_to.active_element
"""
if self._driver.w3c:
return self._driver.execute(Command.W3C_GET_ACTIVE_ELEMENT)['value']... | def active_element(self):
"""
Returns the element with focus, or BODY if nothing has focus.
:Usage:
::
element = driver.switch_to.active_element
"""
if self._driver.w3c:
return self._driver.execute(Command.W3C_GET_ACTIVE_ELEMENT)['value']... | [
"Returns",
"the",
"element",
"with",
"focus",
"or",
"BODY",
"if",
"nothing",
"has",
"focus",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/switch_to.py#L34-L46 | [
"def",
"active_element",
"(",
"self",
")",
":",
"if",
"self",
".",
"_driver",
".",
"w3c",
":",
"return",
"self",
".",
"_driver",
".",
"execute",
"(",
"Command",
".",
"W3C_GET_ACTIVE_ELEMENT",
")",
"[",
"'value'",
"]",
"else",
":",
"return",
"self",
".",
... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | SwitchTo.frame | Switches focus to the specified frame, by index, name, or webelement.
:Args:
- frame_reference: The name of the window to switch to, an integer representing the index,
or a webelement that is an (i)frame to switch to.
:Usage:
::
driver.... | py/selenium/webdriver/remote/switch_to.py | def frame(self, frame_reference):
"""
Switches focus to the specified frame, by index, name, or webelement.
:Args:
- frame_reference: The name of the window to switch to, an integer representing the index,
or a webelement that is an (i)frame to switch to.
... | def frame(self, frame_reference):
"""
Switches focus to the specified frame, by index, name, or webelement.
:Args:
- frame_reference: The name of the window to switch to, an integer representing the index,
or a webelement that is an (i)frame to switch to.
... | [
"Switches",
"focus",
"to",
"the",
"specified",
"frame",
"by",
"index",
"name",
"or",
"webelement",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/switch_to.py#L73-L97 | [
"def",
"frame",
"(",
"self",
",",
"frame_reference",
")",
":",
"if",
"isinstance",
"(",
"frame_reference",
",",
"basestring",
")",
"and",
"self",
".",
"_driver",
".",
"w3c",
":",
"try",
":",
"frame_reference",
"=",
"self",
".",
"_driver",
".",
"find_elemen... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | SwitchTo.new_window | Switches to a new top-level browsing context.
The type hint can be one of "tab" or "window". If not specified the
browser will automatically select it.
:Usage:
::
driver.switch_to.new_window('tab') | py/selenium/webdriver/remote/switch_to.py | def new_window(self, type_hint=None):
"""Switches to a new top-level browsing context.
The type hint can be one of "tab" or "window". If not specified the
browser will automatically select it.
:Usage:
::
driver.switch_to.new_window('tab')
"""
... | def new_window(self, type_hint=None):
"""Switches to a new top-level browsing context.
The type hint can be one of "tab" or "window". If not specified the
browser will automatically select it.
:Usage:
::
driver.switch_to.new_window('tab')
"""
... | [
"Switches",
"to",
"a",
"new",
"top",
"-",
"level",
"browsing",
"context",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/switch_to.py#L99-L111 | [
"def",
"new_window",
"(",
"self",
",",
"type_hint",
"=",
"None",
")",
":",
"value",
"=",
"self",
".",
"_driver",
".",
"execute",
"(",
"Command",
".",
"NEW_WINDOW",
",",
"{",
"'type'",
":",
"type_hint",
"}",
")",
"[",
"'value'",
"]",
"self",
".",
"_w3... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | SwitchTo.window | Switches focus to the specified window.
:Args:
- window_name: The name or window handle of the window to switch to.
:Usage:
::
driver.switch_to.window('main') | py/selenium/webdriver/remote/switch_to.py | def window(self, window_name):
"""
Switches focus to the specified window.
:Args:
- window_name: The name or window handle of the window to switch to.
:Usage:
::
driver.switch_to.window('main')
"""
if self._driver.w3c:
s... | def window(self, window_name):
"""
Switches focus to the specified window.
:Args:
- window_name: The name or window handle of the window to switch to.
:Usage:
::
driver.switch_to.window('main')
"""
if self._driver.w3c:
s... | [
"Switches",
"focus",
"to",
"the",
"specified",
"window",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/switch_to.py#L125-L141 | [
"def",
"window",
"(",
"self",
",",
"window_name",
")",
":",
"if",
"self",
".",
"_driver",
".",
"w3c",
":",
"self",
".",
"_w3c_window",
"(",
"window_name",
")",
"return",
"data",
"=",
"{",
"'name'",
":",
"window_name",
"}",
"self",
".",
"_driver",
".",
... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | ActionChains.perform | Performs all stored actions. | py/selenium/webdriver/common/action_chains.py | def perform(self):
"""
Performs all stored actions.
"""
if self._driver.w3c:
self.w3c_actions.perform()
else:
for action in self._actions:
action() | def perform(self):
"""
Performs all stored actions.
"""
if self._driver.w3c:
self.w3c_actions.perform()
else:
for action in self._actions:
action() | [
"Performs",
"all",
"stored",
"actions",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/common/action_chains.py#L75-L83 | [
"def",
"perform",
"(",
"self",
")",
":",
"if",
"self",
".",
"_driver",
".",
"w3c",
":",
"self",
".",
"w3c_actions",
".",
"perform",
"(",
")",
"else",
":",
"for",
"action",
"in",
"self",
".",
"_actions",
":",
"action",
"(",
")"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | ActionChains.reset_actions | Clears actions that are already stored locally and on the remote end | py/selenium/webdriver/common/action_chains.py | def reset_actions(self):
"""
Clears actions that are already stored locally and on the remote end
"""
if self._driver.w3c:
self.w3c_actions.clear_actions()
self._actions = [] | def reset_actions(self):
"""
Clears actions that are already stored locally and on the remote end
"""
if self._driver.w3c:
self.w3c_actions.clear_actions()
self._actions = [] | [
"Clears",
"actions",
"that",
"are",
"already",
"stored",
"locally",
"and",
"on",
"the",
"remote",
"end"
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/common/action_chains.py#L85-L91 | [
"def",
"reset_actions",
"(",
"self",
")",
":",
"if",
"self",
".",
"_driver",
".",
"w3c",
":",
"self",
".",
"w3c_actions",
".",
"clear_actions",
"(",
")",
"self",
".",
"_actions",
"=",
"[",
"]"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | ActionChains.click_and_hold | Holds down the left mouse button on an element.
:Args:
- on_element: The element to mouse down.
If None, clicks on current mouse position. | py/selenium/webdriver/common/action_chains.py | def click_and_hold(self, on_element=None):
"""
Holds down the left mouse button on an element.
:Args:
- on_element: The element to mouse down.
If None, clicks on current mouse position.
"""
if on_element:
self.move_to_element(on_element)
i... | def click_and_hold(self, on_element=None):
"""
Holds down the left mouse button on an element.
:Args:
- on_element: The element to mouse down.
If None, clicks on current mouse position.
"""
if on_element:
self.move_to_element(on_element)
i... | [
"Holds",
"down",
"the",
"left",
"mouse",
"button",
"on",
"an",
"element",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/common/action_chains.py#L112-L128 | [
"def",
"click_and_hold",
"(",
"self",
",",
"on_element",
"=",
"None",
")",
":",
"if",
"on_element",
":",
"self",
".",
"move_to_element",
"(",
"on_element",
")",
"if",
"self",
".",
"_driver",
".",
"w3c",
":",
"self",
".",
"w3c_actions",
".",
"pointer_action... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | ActionChains.context_click | Performs a context-click (right click) on an element.
:Args:
- on_element: The element to context-click.
If None, clicks on current mouse position. | py/selenium/webdriver/common/action_chains.py | def context_click(self, on_element=None):
"""
Performs a context-click (right click) on an element.
:Args:
- on_element: The element to context-click.
If None, clicks on current mouse position.
"""
if on_element:
self.move_to_element(on_element)
... | def context_click(self, on_element=None):
"""
Performs a context-click (right click) on an element.
:Args:
- on_element: The element to context-click.
If None, clicks on current mouse position.
"""
if on_element:
self.move_to_element(on_element)
... | [
"Performs",
"a",
"context",
"-",
"click",
"(",
"right",
"click",
")",
"on",
"an",
"element",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/common/action_chains.py#L130-L147 | [
"def",
"context_click",
"(",
"self",
",",
"on_element",
"=",
"None",
")",
":",
"if",
"on_element",
":",
"self",
".",
"move_to_element",
"(",
"on_element",
")",
"if",
"self",
".",
"_driver",
".",
"w3c",
":",
"self",
".",
"w3c_actions",
".",
"pointer_action"... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | ActionChains.double_click | Double-clicks an element.
:Args:
- on_element: The element to double-click.
If None, clicks on current mouse position. | py/selenium/webdriver/common/action_chains.py | def double_click(self, on_element=None):
"""
Double-clicks an element.
:Args:
- on_element: The element to double-click.
If None, clicks on current mouse position.
"""
if on_element:
self.move_to_element(on_element)
if self._driver.w3c:
... | def double_click(self, on_element=None):
"""
Double-clicks an element.
:Args:
- on_element: The element to double-click.
If None, clicks on current mouse position.
"""
if on_element:
self.move_to_element(on_element)
if self._driver.w3c:
... | [
"Double",
"-",
"clicks",
"an",
"element",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/common/action_chains.py#L149-L166 | [
"def",
"double_click",
"(",
"self",
",",
"on_element",
"=",
"None",
")",
":",
"if",
"on_element",
":",
"self",
".",
"move_to_element",
"(",
"on_element",
")",
"if",
"self",
".",
"_driver",
".",
"w3c",
":",
"self",
".",
"w3c_actions",
".",
"pointer_action",... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | ActionChains.drag_and_drop | Holds down the left mouse button on the source element,
then moves to the target element and releases the mouse button.
:Args:
- source: The element to mouse down.
- target: The element to mouse up. | py/selenium/webdriver/common/action_chains.py | def drag_and_drop(self, source, target):
"""
Holds down the left mouse button on the source element,
then moves to the target element and releases the mouse button.
:Args:
- source: The element to mouse down.
- target: The element to mouse up.
"""
se... | def drag_and_drop(self, source, target):
"""
Holds down the left mouse button on the source element,
then moves to the target element and releases the mouse button.
:Args:
- source: The element to mouse down.
- target: The element to mouse up.
"""
se... | [
"Holds",
"down",
"the",
"left",
"mouse",
"button",
"on",
"the",
"source",
"element",
"then",
"moves",
"to",
"the",
"target",
"element",
"and",
"releases",
"the",
"mouse",
"button",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/common/action_chains.py#L168-L179 | [
"def",
"drag_and_drop",
"(",
"self",
",",
"source",
",",
"target",
")",
":",
"self",
".",
"click_and_hold",
"(",
"source",
")",
"self",
".",
"release",
"(",
"target",
")",
"return",
"self"
] | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | ActionChains.drag_and_drop_by_offset | Holds down the left mouse button on the source element,
then moves to the target offset and releases the mouse button.
:Args:
- source: The element to mouse down.
- xoffset: X offset to move to.
- yoffset: Y offset to move to. | py/selenium/webdriver/common/action_chains.py | def drag_and_drop_by_offset(self, source, xoffset, yoffset):
"""
Holds down the left mouse button on the source element,
then moves to the target offset and releases the mouse button.
:Args:
- source: The element to mouse down.
- xoffset: X offset to move to.
... | def drag_and_drop_by_offset(self, source, xoffset, yoffset):
"""
Holds down the left mouse button on the source element,
then moves to the target offset and releases the mouse button.
:Args:
- source: The element to mouse down.
- xoffset: X offset to move to.
... | [
"Holds",
"down",
"the",
"left",
"mouse",
"button",
"on",
"the",
"source",
"element",
"then",
"moves",
"to",
"the",
"target",
"offset",
"and",
"releases",
"the",
"mouse",
"button",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/common/action_chains.py#L181-L194 | [
"def",
"drag_and_drop_by_offset",
"(",
"self",
",",
"source",
",",
"xoffset",
",",
"yoffset",
")",
":",
"self",
".",
"click_and_hold",
"(",
"source",
")",
"self",
".",
"move_by_offset",
"(",
"xoffset",
",",
"yoffset",
")",
"self",
".",
"release",
"(",
")",... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
train | ActionChains.key_down | Sends a key press only, without releasing it.
Should only be used with modifier keys (Control, Alt and Shift).
:Args:
- value: The modifier key to send. Values are defined in `Keys` class.
- element: The element to send keys.
If None, sends a key to current focused eleme... | py/selenium/webdriver/common/action_chains.py | def key_down(self, value, element=None):
"""
Sends a key press only, without releasing it.
Should only be used with modifier keys (Control, Alt and Shift).
:Args:
- value: The modifier key to send. Values are defined in `Keys` class.
- element: The element to send k... | def key_down(self, value, element=None):
"""
Sends a key press only, without releasing it.
Should only be used with modifier keys (Control, Alt and Shift).
:Args:
- value: The modifier key to send. Values are defined in `Keys` class.
- element: The element to send k... | [
"Sends",
"a",
"key",
"press",
"only",
"without",
"releasing",
"it",
".",
"Should",
"only",
"be",
"used",
"with",
"modifier",
"keys",
"(",
"Control",
"Alt",
"and",
"Shift",
")",
"."
] | SeleniumHQ/selenium | python | https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/common/action_chains.py#L196-L220 | [
"def",
"key_down",
"(",
"self",
",",
"value",
",",
"element",
"=",
"None",
")",
":",
"if",
"element",
":",
"self",
".",
"click",
"(",
"element",
")",
"if",
"self",
".",
"_driver",
".",
"w3c",
":",
"self",
".",
"w3c_actions",
".",
"key_action",
".",
... | df40c28b41d4b3953f90eaff84838a9ac052b84a |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.