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 | BaseCase.generate_referral | This method opens the start_page, creates a referral link there,
and clicks on that link, which goes to the destination_page.
(This generates real traffic for testing analytics software.) | seleniumbase/fixtures/base_case.py | def generate_referral(self, start_page, destination_page):
""" This method opens the start_page, creates a referral link there,
and clicks on that link, which goes to the destination_page.
(This generates real traffic for testing analytics software.) """
if not page_utils.is_vali... | def generate_referral(self, start_page, destination_page):
""" This method opens the start_page, creates a referral link there,
and clicks on that link, which goes to the destination_page.
(This generates real traffic for testing analytics software.) """
if not page_utils.is_vali... | [
"This",
"method",
"opens",
"the",
"start_page",
"creates",
"a",
"referral",
"link",
"there",
"and",
"clicks",
"on",
"that",
"link",
"which",
"goes",
"to",
"the",
"destination_page",
".",
"(",
"This",
"generates",
"real",
"traffic",
"for",
"testing",
"analytics... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2048-L2079 | [
"def",
"generate_referral",
"(",
"self",
",",
"start_page",
",",
"destination_page",
")",
":",
"if",
"not",
"page_utils",
".",
"is_valid_url",
"(",
"destination_page",
")",
":",
"raise",
"Exception",
"(",
"\"Exception: destination_page {%s} is not a valid URL!\"",
"%",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.generate_traffic | Similar to generate_referral(), but can do multiple loops. | seleniumbase/fixtures/base_case.py | def generate_traffic(self, start_page, destination_page, loops=1):
""" Similar to generate_referral(), but can do multiple loops. """
for loop in range(loops):
self.generate_referral(start_page, destination_page)
time.sleep(0.05) | def generate_traffic(self, start_page, destination_page, loops=1):
""" Similar to generate_referral(), but can do multiple loops. """
for loop in range(loops):
self.generate_referral(start_page, destination_page)
time.sleep(0.05) | [
"Similar",
"to",
"generate_referral",
"()",
"but",
"can",
"do",
"multiple",
"loops",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2081-L2085 | [
"def",
"generate_traffic",
"(",
"self",
",",
"start_page",
",",
"destination_page",
",",
"loops",
"=",
"1",
")",
":",
"for",
"loop",
"in",
"range",
"(",
"loops",
")",
":",
"self",
".",
"generate_referral",
"(",
"start_page",
",",
"destination_page",
")",
"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.generate_referral_chain | Use this method to chain the action of creating button links on
one website page that will take you to the next page.
(When you want to create a referral to a website for traffic
generation without increasing the bounce rate, you'll want to visit
at least one additional p... | seleniumbase/fixtures/base_case.py | def generate_referral_chain(self, pages):
""" Use this method to chain the action of creating button links on
one website page that will take you to the next page.
(When you want to create a referral to a website for traffic
generation without increasing the bounce rate, you'... | def generate_referral_chain(self, pages):
""" Use this method to chain the action of creating button links on
one website page that will take you to the next page.
(When you want to create a referral to a website for traffic
generation without increasing the bounce rate, you'... | [
"Use",
"this",
"method",
"to",
"chain",
"the",
"action",
"of",
"creating",
"button",
"links",
"on",
"one",
"website",
"page",
"that",
"will",
"take",
"you",
"to",
"the",
"next",
"page",
".",
"(",
"When",
"you",
"want",
"to",
"create",
"a",
"referral",
... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2087-L2105 | [
"def",
"generate_referral_chain",
"(",
"self",
",",
"pages",
")",
":",
"if",
"not",
"type",
"(",
"pages",
")",
"is",
"tuple",
"and",
"not",
"type",
"(",
"pages",
")",
"is",
"list",
":",
"raise",
"Exception",
"(",
"\"Exception: Expecting a list of website pages... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.generate_traffic_chain | Similar to generate_referral_chain(), but for multiple loops. | seleniumbase/fixtures/base_case.py | def generate_traffic_chain(self, pages, loops=1):
""" Similar to generate_referral_chain(), but for multiple loops. """
for loop in range(loops):
self.generate_referral_chain(pages)
time.sleep(0.05) | def generate_traffic_chain(self, pages, loops=1):
""" Similar to generate_referral_chain(), but for multiple loops. """
for loop in range(loops):
self.generate_referral_chain(pages)
time.sleep(0.05) | [
"Similar",
"to",
"generate_referral_chain",
"()",
"but",
"for",
"multiple",
"loops",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2107-L2111 | [
"def",
"generate_traffic_chain",
"(",
"self",
",",
"pages",
",",
"loops",
"=",
"1",
")",
":",
"for",
"loop",
"in",
"range",
"(",
"loops",
")",
":",
"self",
".",
"generate_referral_chain",
"(",
"pages",
")",
"time",
".",
"sleep",
"(",
"0.05",
")"
] | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.assert_element_present | Similar to wait_for_element_present(), but returns nothing.
Waits for an element to appear in the HTML of a page.
The element does not need be visible (it may be hidden).
Returns True if successful. Default timeout = SMALL_TIMEOUT. | seleniumbase/fixtures/base_case.py | def assert_element_present(self, selector, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Similar to wait_for_element_present(), but returns nothing.
Waits for an element to appear in the HTML of a page.
The element does not need be visible (it ma... | def assert_element_present(self, selector, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Similar to wait_for_element_present(), but returns nothing.
Waits for an element to appear in the HTML of a page.
The element does not need be visible (it ma... | [
"Similar",
"to",
"wait_for_element_present",
"()",
"but",
"returns",
"nothing",
".",
"Waits",
"for",
"an",
"element",
"to",
"appear",
"in",
"the",
"HTML",
"of",
"a",
"page",
".",
"The",
"element",
"does",
"not",
"need",
"be",
"visible",
"(",
"it",
"may",
... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2129-L2138 | [
"def",
"assert_element_present",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",
".",
"SMAL... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.wait_for_element_visible | Waits for an element to appear in the HTML of a page.
The element must be visible (it cannot be hidden). | seleniumbase/fixtures/base_case.py | def wait_for_element_visible(self, selector, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" Waits for an element to appear in the HTML of a page.
The element must be visible (it cannot be hidden). """
if page_utils.is_xpath_selector(selector):
... | def wait_for_element_visible(self, selector, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" Waits for an element to appear in the HTML of a page.
The element must be visible (it cannot be hidden). """
if page_utils.is_xpath_selector(selector):
... | [
"Waits",
"for",
"an",
"element",
"to",
"appear",
"in",
"the",
"HTML",
"of",
"a",
"page",
".",
"The",
"element",
"must",
"be",
"visible",
"(",
"it",
"cannot",
"be",
"hidden",
")",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2145-L2155 | [
"def",
"wait_for_element_visible",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT",
")",
":",
"if",
"page_utils",
".",
"is_xpath_selector",
"(",
"selector",
")",
":",
"by",
"=",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.wait_for_element | The shorter version of wait_for_element_visible() | seleniumbase/fixtures/base_case.py | def wait_for_element(self, selector, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" The shorter version of wait_for_element_visible() """
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
ret... | def wait_for_element(self, selector, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" The shorter version of wait_for_element_visible() """
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
ret... | [
"The",
"shorter",
"version",
"of",
"wait_for_element_visible",
"()"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2157-L2162 | [
"def",
"wait_for_element",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",
".",
"LARGE_TIME... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.assert_element_visible | Same as self.assert_element()
As above, will raise an exception if nothing can be found. | seleniumbase/fixtures/base_case.py | def assert_element_visible(self, selector, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Same as self.assert_element()
As above, will raise an exception if nothing can be found. """
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
... | def assert_element_visible(self, selector, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Same as self.assert_element()
As above, will raise an exception if nothing can be found. """
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
... | [
"Same",
"as",
"self",
".",
"assert_element",
"()",
"As",
"above",
"will",
"raise",
"an",
"exception",
"if",
"nothing",
"can",
"be",
"found",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2190-L2197 | [
"def",
"assert_element_visible",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",
".",
"SMAL... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.wait_for_text | The shorter version of wait_for_text_visible() | seleniumbase/fixtures/base_case.py | def wait_for_text(self, text, selector="html", by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" The shorter version of wait_for_text_visible() """
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
... | def wait_for_text(self, text, selector="html", by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" The shorter version of wait_for_text_visible() """
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
... | [
"The",
"shorter",
"version",
"of",
"wait_for_text_visible",
"()"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2229-L2235 | [
"def",
"wait_for_text",
"(",
"self",
",",
"text",
",",
"selector",
"=",
"\"html\"",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.assert_text_visible | Same as assert_text() | seleniumbase/fixtures/base_case.py | def assert_text_visible(self, text, selector="html", by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Same as assert_text() """
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
return self.... | def assert_text_visible(self, text, selector="html", by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Same as assert_text() """
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
return self.... | [
"Same",
"as",
"assert_text",
"()"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2245-L2250 | [
"def",
"assert_text_visible",
"(",
"self",
",",
"text",
",",
"selector",
"=",
"\"html\"",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.assert_exact_text | Similar to assert_text(), but the text must be exact, rather than
exist as a subset of the full text.
(Extra whitespace at the beginning or the end doesn't count.)
Raises an exception if the element or the text is not found.
Returns True if successful. Default timeout = S... | seleniumbase/fixtures/base_case.py | def assert_exact_text(self, text, selector="html", by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Similar to assert_text(), but the text must be exact, rather than
exist as a subset of the full text.
(Extra whitespace at the beginning or the end doesn'... | def assert_exact_text(self, text, selector="html", by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Similar to assert_text(), but the text must be exact, rather than
exist as a subset of the full text.
(Extra whitespace at the beginning or the end doesn'... | [
"Similar",
"to",
"assert_text",
"()",
"but",
"the",
"text",
"must",
"be",
"exact",
"rather",
"than",
"exist",
"as",
"a",
"subset",
"of",
"the",
"full",
"text",
".",
"(",
"Extra",
"whitespace",
"at",
"the",
"beginning",
"or",
"the",
"end",
"doesn",
"t",
... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2272-L2293 | [
"def",
"assert_exact_text",
"(",
"self",
",",
"text",
",",
"selector",
"=",
"\"html\"",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.wait_for_link_text | The shorter version of wait_for_link_text_visible() | seleniumbase/fixtures/base_case.py | def wait_for_link_text(self, link_text, timeout=settings.LARGE_TIMEOUT):
""" The shorter version of wait_for_link_text_visible() """
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
return self.wait_for_link_text_visible(link... | def wait_for_link_text(self, link_text, timeout=settings.LARGE_TIMEOUT):
""" The shorter version of wait_for_link_text_visible() """
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
return self.wait_for_link_text_visible(link... | [
"The",
"shorter",
"version",
"of",
"wait_for_link_text_visible",
"()"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2307-L2311 | [
"def",
"wait_for_link_text",
"(",
"self",
",",
"link_text",
",",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",
".",
"LARGE_TIMEOUT",
":",
"timeout",
"=",
"self",
".",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.assert_link_text | Similar to wait_for_link_text_visible(), but returns nothing.
As above, will raise an exception if nothing can be found.
Returns True if successful. Default timeout = SMALL_TIMEOUT. | seleniumbase/fixtures/base_case.py | def assert_link_text(self, link_text, timeout=settings.SMALL_TIMEOUT):
""" Similar to wait_for_link_text_visible(), but returns nothing.
As above, will raise an exception if nothing can be found.
Returns True if successful. Default timeout = SMALL_TIMEOUT. """
if self.timeout_mul... | def assert_link_text(self, link_text, timeout=settings.SMALL_TIMEOUT):
""" Similar to wait_for_link_text_visible(), but returns nothing.
As above, will raise an exception if nothing can be found.
Returns True if successful. Default timeout = SMALL_TIMEOUT. """
if self.timeout_mul... | [
"Similar",
"to",
"wait_for_link_text_visible",
"()",
"but",
"returns",
"nothing",
".",
"As",
"above",
"will",
"raise",
"an",
"exception",
"if",
"nothing",
"can",
"be",
"found",
".",
"Returns",
"True",
"if",
"successful",
".",
"Default",
"timeout",
"=",
"SMALL_... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2319-L2330 | [
"def",
"assert_link_text",
"(",
"self",
",",
"link_text",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",
".",
"SMALL_TIMEOUT",
":",
"timeout",
"=",
"self",
".",
"_... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.find_partial_link_text | Same as wait_for_partial_link_text() - returns the element | seleniumbase/fixtures/base_case.py | def find_partial_link_text(self, partial_link_text,
timeout=settings.LARGE_TIMEOUT):
""" Same as wait_for_partial_link_text() - returns the element """
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
... | def find_partial_link_text(self, partial_link_text,
timeout=settings.LARGE_TIMEOUT):
""" Same as wait_for_partial_link_text() - returns the element """
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
... | [
"Same",
"as",
"wait_for_partial_link_text",
"()",
"-",
"returns",
"the",
"element"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2344-L2350 | [
"def",
"find_partial_link_text",
"(",
"self",
",",
"partial_link_text",
",",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",
".",
"LARGE_TIMEOUT",
":",
"timeout",
"=",
"self... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.assert_partial_link_text | Similar to wait_for_partial_link_text(), but returns nothing.
As above, will raise an exception if nothing can be found.
Returns True if successful. Default timeout = SMALL_TIMEOUT. | seleniumbase/fixtures/base_case.py | def assert_partial_link_text(self, partial_link_text,
timeout=settings.SMALL_TIMEOUT):
""" Similar to wait_for_partial_link_text(), but returns nothing.
As above, will raise an exception if nothing can be found.
Returns True if successful. Default timeout... | def assert_partial_link_text(self, partial_link_text,
timeout=settings.SMALL_TIMEOUT):
""" Similar to wait_for_partial_link_text(), but returns nothing.
As above, will raise an exception if nothing can be found.
Returns True if successful. Default timeout... | [
"Similar",
"to",
"wait_for_partial_link_text",
"()",
"but",
"returns",
"nothing",
".",
"As",
"above",
"will",
"raise",
"an",
"exception",
"if",
"nothing",
"can",
"be",
"found",
".",
"Returns",
"True",
"if",
"successful",
".",
"Default",
"timeout",
"=",
"SMALL_... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2352-L2360 | [
"def",
"assert_partial_link_text",
"(",
"self",
",",
"partial_link_text",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",
".",
"SMALL_TIMEOUT",
":",
"timeout",
"=",
"se... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.wait_for_element_absent | Waits for an element to no longer appear in the HTML of a page.
A hidden element still counts as appearing in the page HTML.
If an element with "hidden" status is acceptable,
use wait_for_element_not_visible() instead. | seleniumbase/fixtures/base_case.py | def wait_for_element_absent(self, selector, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" Waits for an element to no longer appear in the HTML of a page.
A hidden element still counts as appearing in the page HTML.
If an element with "hidden" st... | def wait_for_element_absent(self, selector, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" Waits for an element to no longer appear in the HTML of a page.
A hidden element still counts as appearing in the page HTML.
If an element with "hidden" st... | [
"Waits",
"for",
"an",
"element",
"to",
"no",
"longer",
"appear",
"in",
"the",
"HTML",
"of",
"a",
"page",
".",
"A",
"hidden",
"element",
"still",
"counts",
"as",
"appearing",
"in",
"the",
"page",
"HTML",
".",
"If",
"an",
"element",
"with",
"hidden",
"st... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2364-L2375 | [
"def",
"wait_for_element_absent",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",
".",
"LAR... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.assert_element_absent | Similar to wait_for_element_absent() - returns nothing.
As above, will raise an exception if the element stays present.
Returns True if successful. Default timeout = SMALL_TIMEOUT. | seleniumbase/fixtures/base_case.py | def assert_element_absent(self, selector, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Similar to wait_for_element_absent() - returns nothing.
As above, will raise an exception if the element stays present.
Returns True if successful. Default tim... | def assert_element_absent(self, selector, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Similar to wait_for_element_absent() - returns nothing.
As above, will raise an exception if the element stays present.
Returns True if successful. Default tim... | [
"Similar",
"to",
"wait_for_element_absent",
"()",
"-",
"returns",
"nothing",
".",
"As",
"above",
"will",
"raise",
"an",
"exception",
"if",
"the",
"element",
"stays",
"present",
".",
"Returns",
"True",
"if",
"successful",
".",
"Default",
"timeout",
"=",
"SMALL_... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2377-L2385 | [
"def",
"assert_element_absent",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",
".",
"SMALL... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.assert_element_not_visible | Similar to wait_for_element_not_visible() - returns nothing.
As above, will raise an exception if the element stays visible.
Returns True if successful. Default timeout = SMALL_TIMEOUT. | seleniumbase/fixtures/base_case.py | def assert_element_not_visible(self, selector, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Similar to wait_for_element_not_visible() - returns nothing.
As above, will raise an exception if the element stays visible.
Returns True if successf... | def assert_element_not_visible(self, selector, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Similar to wait_for_element_not_visible() - returns nothing.
As above, will raise an exception if the element stays visible.
Returns True if successf... | [
"Similar",
"to",
"wait_for_element_not_visible",
"()",
"-",
"returns",
"nothing",
".",
"As",
"above",
"will",
"raise",
"an",
"exception",
"if",
"the",
"element",
"stays",
"visible",
".",
"Returns",
"True",
"if",
"successful",
".",
"Default",
"timeout",
"=",
"S... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2404-L2412 | [
"def",
"assert_element_not_visible",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",
".",
"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.switch_to_frame | Sets driver control to the specified browser frame. | seleniumbase/fixtures/base_case.py | def switch_to_frame(self, frame, timeout=settings.SMALL_TIMEOUT):
""" Sets driver control to the specified browser frame. """
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
page_actions.switch_to_frame(self.driver, frame, t... | def switch_to_frame(self, frame, timeout=settings.SMALL_TIMEOUT):
""" Sets driver control to the specified browser frame. """
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
page_actions.switch_to_frame(self.driver, frame, t... | [
"Sets",
"driver",
"control",
"to",
"the",
"specified",
"browser",
"frame",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2454-L2458 | [
"def",
"switch_to_frame",
"(",
"self",
",",
"frame",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",
".",
"SMALL_TIMEOUT",
":",
"timeout",
"=",
"self",
".",
"__get_... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.open_new_window | Opens a new browser tab/window and switches to it by default. | seleniumbase/fixtures/base_case.py | def open_new_window(self, switch_to=True):
""" Opens a new browser tab/window and switches to it by default. """
self.driver.execute_script("window.open('');")
time.sleep(0.01)
if switch_to:
self.switch_to_window(len(self.driver.window_handles) - 1) | def open_new_window(self, switch_to=True):
""" Opens a new browser tab/window and switches to it by default. """
self.driver.execute_script("window.open('');")
time.sleep(0.01)
if switch_to:
self.switch_to_window(len(self.driver.window_handles) - 1) | [
"Opens",
"a",
"new",
"browser",
"tab",
"/",
"window",
"and",
"switches",
"to",
"it",
"by",
"default",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2467-L2472 | [
"def",
"open_new_window",
"(",
"self",
",",
"switch_to",
"=",
"True",
")",
":",
"self",
".",
"driver",
".",
"execute_script",
"(",
"\"window.open('');\"",
")",
"time",
".",
"sleep",
"(",
"0.01",
")",
"if",
"switch_to",
":",
"self",
".",
"switch_to_window",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.check_window | *** Automated Visual Testing with SeleniumBase ***
The first time a test calls self.check_window() for a unique "name"
parameter provided, it will set a visual baseline, meaning that it
creates a folder, saves the URL to a file, saves the current window
screenshot to a... | seleniumbase/fixtures/base_case.py | def check_window(self, name="default", level=0, baseline=False):
""" *** Automated Visual Testing with SeleniumBase ***
The first time a test calls self.check_window() for a unique "name"
parameter provided, it will set a visual baseline, meaning that it
creates a folder, ... | def check_window(self, name="default", level=0, baseline=False):
""" *** Automated Visual Testing with SeleniumBase ***
The first time a test calls self.check_window() for a unique "name"
parameter provided, it will set a visual baseline, meaning that it
creates a folder, ... | [
"***",
"Automated",
"Visual",
"Testing",
"with",
"SeleniumBase",
"***"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2482-L2672 | [
"def",
"check_window",
"(",
"self",
",",
"name",
"=",
"\"default\"",
",",
"level",
"=",
"0",
",",
"baseline",
"=",
"False",
")",
":",
"if",
"level",
"==",
"\"0\"",
":",
"level",
"=",
"0",
"if",
"level",
"==",
"\"1\"",
":",
"level",
"=",
"1",
"if",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.save_screenshot | The screenshot will be in PNG format. | seleniumbase/fixtures/base_case.py | def save_screenshot(self, name, folder=None):
""" The screenshot will be in PNG format. """
return page_actions.save_screenshot(self.driver, name, folder) | def save_screenshot(self, name, folder=None):
""" The screenshot will be in PNG format. """
return page_actions.save_screenshot(self.driver, name, folder) | [
"The",
"screenshot",
"will",
"be",
"in",
"PNG",
"format",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2674-L2676 | [
"def",
"save_screenshot",
"(",
"self",
",",
"name",
",",
"folder",
"=",
"None",
")",
":",
"return",
"page_actions",
".",
"save_screenshot",
"(",
"self",
".",
"driver",
",",
"name",
",",
"folder",
")"
] | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.get_new_driver | This method spins up an extra browser for tests that require
more than one. The first browser is already provided by tests
that import base_case.BaseCase from seleniumbase. If parameters
aren't specified, the method uses the same as the default driver.
@Params
... | seleniumbase/fixtures/base_case.py | def get_new_driver(self, browser=None, headless=None,
servername=None, port=None, proxy=None, agent=None,
switch_to=True, cap_file=None, disable_csp=None):
""" This method spins up an extra browser for tests that require
more than one. The first browser ... | def get_new_driver(self, browser=None, headless=None,
servername=None, port=None, proxy=None, agent=None,
switch_to=True, cap_file=None, disable_csp=None):
""" This method spins up an extra browser for tests that require
more than one. The first browser ... | [
"This",
"method",
"spins",
"up",
"an",
"extra",
"browser",
"for",
"tests",
"that",
"require",
"more",
"than",
"one",
".",
"The",
"first",
"browser",
"is",
"already",
"provided",
"by",
"tests",
"that",
"import",
"base_case",
".",
"BaseCase",
"from",
"selenium... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2678-L2780 | [
"def",
"get_new_driver",
"(",
"self",
",",
"browser",
"=",
"None",
",",
"headless",
"=",
"None",
",",
"servername",
"=",
"None",
",",
"port",
"=",
"None",
",",
"proxy",
"=",
"None",
",",
"agent",
"=",
"None",
",",
"switch_to",
"=",
"True",
",",
"cap_... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.__get_new_timeout | When using --timeout_multiplier=#.# | seleniumbase/fixtures/base_case.py | def __get_new_timeout(self, timeout):
""" When using --timeout_multiplier=#.# """
try:
timeout_multiplier = float(self.timeout_multiplier)
if timeout_multiplier <= 0.5:
timeout_multiplier = 0.5
timeout = int(math.ceil(timeout_multiplier * timeout))
... | def __get_new_timeout(self, timeout):
""" When using --timeout_multiplier=#.# """
try:
timeout_multiplier = float(self.timeout_multiplier)
if timeout_multiplier <= 0.5:
timeout_multiplier = 0.5
timeout = int(math.ceil(timeout_multiplier * timeout))
... | [
"When",
"using",
"--",
"timeout_multiplier",
"=",
"#",
".",
"#"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2793-L2803 | [
"def",
"__get_new_timeout",
"(",
"self",
",",
"timeout",
")",
":",
"try",
":",
"timeout_multiplier",
"=",
"float",
"(",
"self",
".",
"timeout_multiplier",
")",
"if",
"timeout_multiplier",
"<=",
"0.5",
":",
"timeout_multiplier",
"=",
"0.5",
"timeout",
"=",
"int... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.__get_exception_message | This method extracts the message from an exception if there
was an exception that occurred during the test, assuming
that the exception was in a try/except block and not thrown. | seleniumbase/fixtures/base_case.py | def __get_exception_message(self):
""" This method extracts the message from an exception if there
was an exception that occurred during the test, assuming
that the exception was in a try/except block and not thrown. """
exception_info = sys.exc_info()[1]
if hasattr(excep... | def __get_exception_message(self):
""" This method extracts the message from an exception if there
was an exception that occurred during the test, assuming
that the exception was in a try/except block and not thrown. """
exception_info = sys.exc_info()[1]
if hasattr(excep... | [
"This",
"method",
"extracts",
"the",
"message",
"from",
"an",
"exception",
"if",
"there",
"was",
"an",
"exception",
"that",
"occurred",
"during",
"the",
"test",
"assuming",
"that",
"the",
"exception",
"was",
"in",
"a",
"try",
"/",
"except",
"block",
"and",
... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2807-L2818 | [
"def",
"__get_exception_message",
"(",
"self",
")",
":",
"exception_info",
"=",
"sys",
".",
"exc_info",
"(",
")",
"[",
"1",
"]",
"if",
"hasattr",
"(",
"exception_info",
",",
"'msg'",
")",
":",
"exc_message",
"=",
"exception_info",
".",
"msg",
"elif",
"hasa... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.__get_improved_exception_message | If Chromedriver is out-of-date, make it clear!
Given the high popularity of the following StackOverflow article:
https://stackoverflow.com/questions/49162667/unknown-error-
call-function-result-missing-value-for-selenium-send-keys-even
... the original error message was not helpf... | seleniumbase/fixtures/base_case.py | def __get_improved_exception_message(self):
"""
If Chromedriver is out-of-date, make it clear!
Given the high popularity of the following StackOverflow article:
https://stackoverflow.com/questions/49162667/unknown-error-
call-function-result-missing-value-for-selenium-sen... | def __get_improved_exception_message(self):
"""
If Chromedriver is out-of-date, make it clear!
Given the high popularity of the following StackOverflow article:
https://stackoverflow.com/questions/49162667/unknown-error-
call-function-result-missing-value-for-selenium-sen... | [
"If",
"Chromedriver",
"is",
"out",
"-",
"of",
"-",
"date",
"make",
"it",
"clear!",
"Given",
"the",
"high",
"popularity",
"of",
"the",
"following",
"StackOverflow",
"article",
":",
"https",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"491... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2820-L2841 | [
"def",
"__get_improved_exception_message",
"(",
"self",
")",
":",
"exc_message",
"=",
"self",
".",
"__get_exception_message",
"(",
")",
"maybe_using_old_chromedriver",
"=",
"False",
"if",
"\"unknown error: call function result missing\"",
"in",
"exc_message",
":",
"maybe_us... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.__add_delayed_assert_failure | Add a delayed_assert failure into a list for future processing. | seleniumbase/fixtures/base_case.py | def __add_delayed_assert_failure(self):
""" Add a delayed_assert failure into a list for future processing. """
current_url = self.driver.current_url
message = self.__get_exception_message()
self.__delayed_assert_failures.append(
"CHECK #%s: (%s)\n %s" % (
sel... | def __add_delayed_assert_failure(self):
""" Add a delayed_assert failure into a list for future processing. """
current_url = self.driver.current_url
message = self.__get_exception_message()
self.__delayed_assert_failures.append(
"CHECK #%s: (%s)\n %s" % (
sel... | [
"Add",
"a",
"delayed_assert",
"failure",
"into",
"a",
"list",
"for",
"future",
"processing",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2843-L2849 | [
"def",
"__add_delayed_assert_failure",
"(",
"self",
")",
":",
"current_url",
"=",
"self",
".",
"driver",
".",
"current_url",
"message",
"=",
"self",
".",
"__get_exception_message",
"(",
")",
"self",
".",
"__delayed_assert_failures",
".",
"append",
"(",
"\"CHECK #%... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.delayed_assert_element | A non-terminating assertion for an element on a page.
Failures will be saved until the process_delayed_asserts()
method is called from inside a test, likely at the end of it. | seleniumbase/fixtures/base_case.py | def delayed_assert_element(self, selector, by=By.CSS_SELECTOR,
timeout=settings.MINI_TIMEOUT):
""" A non-terminating assertion for an element on a page.
Failures will be saved until the process_delayed_asserts()
method is called from inside a test, likely a... | def delayed_assert_element(self, selector, by=By.CSS_SELECTOR,
timeout=settings.MINI_TIMEOUT):
""" A non-terminating assertion for an element on a page.
Failures will be saved until the process_delayed_asserts()
method is called from inside a test, likely a... | [
"A",
"non",
"-",
"terminating",
"assertion",
"for",
"an",
"element",
"on",
"a",
"page",
".",
"Failures",
"will",
"be",
"saved",
"until",
"the",
"process_delayed_asserts",
"()",
"method",
"is",
"called",
"from",
"inside",
"a",
"test",
"likely",
"at",
"the",
... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2851-L2870 | [
"def",
"delayed_assert_element",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"MINI_TIMEOUT",
")",
":",
"self",
".",
"__delayed_assert_count",
"+=",
"1",
"try",
":",
"url",
"=",
"self",
".",... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.delayed_assert_text | A non-terminating assertion for text from an element on a page.
Failures will be saved until the process_delayed_asserts()
method is called from inside a test, likely at the end of it. | seleniumbase/fixtures/base_case.py | def delayed_assert_text(self, text, selector="html", by=By.CSS_SELECTOR,
timeout=settings.MINI_TIMEOUT):
""" A non-terminating assertion for text from an element on a page.
Failures will be saved until the process_delayed_asserts()
method is called from inside... | def delayed_assert_text(self, text, selector="html", by=By.CSS_SELECTOR,
timeout=settings.MINI_TIMEOUT):
""" A non-terminating assertion for text from an element on a page.
Failures will be saved until the process_delayed_asserts()
method is called from inside... | [
"A",
"non",
"-",
"terminating",
"assertion",
"for",
"text",
"from",
"an",
"element",
"on",
"a",
"page",
".",
"Failures",
"will",
"be",
"saved",
"until",
"the",
"process_delayed_asserts",
"()",
"method",
"is",
"called",
"from",
"inside",
"a",
"test",
"likely"... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2872-L2891 | [
"def",
"delayed_assert_text",
"(",
"self",
",",
"text",
",",
"selector",
"=",
"\"html\"",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"MINI_TIMEOUT",
")",
":",
"self",
".",
"__delayed_assert_count",
"+=",
"1",
"try",
":... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.process_delayed_asserts | To be used with any test that uses delayed_asserts, which are
non-terminating verifications that only raise exceptions
after this method is called.
This is useful for pages with multiple elements to be checked when
you want to find as many bugs as possible in a single tes... | seleniumbase/fixtures/base_case.py | def process_delayed_asserts(self, print_only=False):
""" To be used with any test that uses delayed_asserts, which are
non-terminating verifications that only raise exceptions
after this method is called.
This is useful for pages with multiple elements to be checked when
... | def process_delayed_asserts(self, print_only=False):
""" To be used with any test that uses delayed_asserts, which are
non-terminating verifications that only raise exceptions
after this method is called.
This is useful for pages with multiple elements to be checked when
... | [
"To",
"be",
"used",
"with",
"any",
"test",
"that",
"uses",
"delayed_asserts",
"which",
"are",
"non",
"-",
"terminating",
"verifications",
"that",
"only",
"raise",
"exceptions",
"after",
"this",
"method",
"is",
"called",
".",
"This",
"is",
"useful",
"for",
"p... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2893-L2915 | [
"def",
"process_delayed_asserts",
"(",
"self",
",",
"print_only",
"=",
"False",
")",
":",
"if",
"self",
".",
"__delayed_assert_failures",
":",
"exception_output",
"=",
"''",
"exception_output",
"+=",
"\"\\n*** DELAYED ASSERTION FAILURES FOR: \"",
"exception_output",
"+=",... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.__js_click | Clicks an element using pure JS. Does not use jQuery. | seleniumbase/fixtures/base_case.py | def __js_click(self, selector, by=By.CSS_SELECTOR):
""" Clicks an element using pure JS. Does not use jQuery. """
selector, by = self.__recalculate_selector(selector, by)
css_selector = self.convert_to_css_selector(selector, by=by)
css_selector = re.escape(css_selector)
css_selec... | def __js_click(self, selector, by=By.CSS_SELECTOR):
""" Clicks an element using pure JS. Does not use jQuery. """
selector, by = self.__recalculate_selector(selector, by)
css_selector = self.convert_to_css_selector(selector, by=by)
css_selector = re.escape(css_selector)
css_selec... | [
"Clicks",
"an",
"element",
"using",
"pure",
"JS",
".",
"Does",
"not",
"use",
"jQuery",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2919-L2936 | [
"def",
"__js_click",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
")",
":",
"selector",
",",
"by",
"=",
"self",
".",
"__recalculate_selector",
"(",
"selector",
",",
"by",
")",
"css_selector",
"=",
"self",
".",
"convert_to_css_se... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.__click_dropdown_link_text | When a link may be hidden under a dropdown menu, use this. | seleniumbase/fixtures/base_case.py | def __click_dropdown_link_text(self, link_text, link_css):
""" When a link may be hidden under a dropdown menu, use this. """
soup = self.get_beautiful_soup()
drop_down_list = soup.select('[class*=dropdown]')
for item in soup.select('[class*=HeaderMenu]'):
drop_down_list.appe... | def __click_dropdown_link_text(self, link_text, link_css):
""" When a link may be hidden under a dropdown menu, use this. """
soup = self.get_beautiful_soup()
drop_down_list = soup.select('[class*=dropdown]')
for item in soup.select('[class*=HeaderMenu]'):
drop_down_list.appe... | [
"When",
"a",
"link",
"may",
"be",
"hidden",
"under",
"a",
"dropdown",
"menu",
"use",
"this",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2964-L2992 | [
"def",
"__click_dropdown_link_text",
"(",
"self",
",",
"link_text",
",",
"link_css",
")",
":",
"soup",
"=",
"self",
".",
"get_beautiful_soup",
"(",
")",
"drop_down_list",
"=",
"soup",
".",
"select",
"(",
"'[class*=dropdown]'",
")",
"for",
"item",
"in",
"soup",... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.setUp | Be careful if a subclass of BaseCase overrides setUp()
You'll need to add the following line to the subclass setUp() method:
super(SubClassOfBaseCase, self).setUp() | seleniumbase/fixtures/base_case.py | def setUp(self, masterqa_mode=False):
"""
Be careful if a subclass of BaseCase overrides setUp()
You'll need to add the following line to the subclass setUp() method:
super(SubClassOfBaseCase, self).setUp()
"""
self.masterqa_mode = masterqa_mode
self.is_pytest = N... | def setUp(self, masterqa_mode=False):
"""
Be careful if a subclass of BaseCase overrides setUp()
You'll need to add the following line to the subclass setUp() method:
super(SubClassOfBaseCase, self).setUp()
"""
self.masterqa_mode = masterqa_mode
self.is_pytest = N... | [
"Be",
"careful",
"if",
"a",
"subclass",
"of",
"BaseCase",
"overrides",
"setUp",
"()",
"You",
"ll",
"need",
"to",
"add",
"the",
"following",
"line",
"to",
"the",
"subclass",
"setUp",
"()",
"method",
":",
"super",
"(",
"SubClassOfBaseCase",
"self",
")",
".",... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L3079-L3200 | [
"def",
"setUp",
"(",
"self",
",",
"masterqa_mode",
"=",
"False",
")",
":",
"self",
".",
"masterqa_mode",
"=",
"masterqa_mode",
"self",
".",
"is_pytest",
"=",
"None",
"try",
":",
"# This raises an exception if the test is not coming from pytest",
"self",
".",
"is_pyt... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.__set_last_page_screenshot | self.__last_page_screenshot is only for pytest html report logs
self.__last_page_screenshot_png is for all screenshot log files | seleniumbase/fixtures/base_case.py | def __set_last_page_screenshot(self):
""" self.__last_page_screenshot is only for pytest html report logs
self.__last_page_screenshot_png is for all screenshot log files """
if not self.__last_page_screenshot and (
not self.__last_page_screenshot_png):
try:
... | def __set_last_page_screenshot(self):
""" self.__last_page_screenshot is only for pytest html report logs
self.__last_page_screenshot_png is for all screenshot log files """
if not self.__last_page_screenshot and (
not self.__last_page_screenshot_png):
try:
... | [
"self",
".",
"__last_page_screenshot",
"is",
"only",
"for",
"pytest",
"html",
"report",
"logs",
"self",
".",
"__last_page_screenshot_png",
"is",
"for",
"all",
"screenshot",
"log",
"files"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L3202-L3228 | [
"def",
"__set_last_page_screenshot",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__last_page_screenshot",
"and",
"(",
"not",
"self",
".",
"__last_page_screenshot_png",
")",
":",
"try",
":",
"element",
"=",
"self",
".",
"driver",
".",
"find_element_by_tag_n... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.tearDown | Be careful if a subclass of BaseCase overrides setUp()
You'll need to add the following line to the subclass's tearDown():
super(SubClassOfBaseCase, self).tearDown() | seleniumbase/fixtures/base_case.py | def tearDown(self):
"""
Be careful if a subclass of BaseCase overrides setUp()
You'll need to add the following line to the subclass's tearDown():
super(SubClassOfBaseCase, self).tearDown()
"""
has_exception = False
if sys.version.startswith('3') and hasattr(self,... | def tearDown(self):
"""
Be careful if a subclass of BaseCase overrides setUp()
You'll need to add the following line to the subclass's tearDown():
super(SubClassOfBaseCase, self).tearDown()
"""
has_exception = False
if sys.version.startswith('3') and hasattr(self,... | [
"Be",
"careful",
"if",
"a",
"subclass",
"of",
"BaseCase",
"overrides",
"setUp",
"()",
"You",
"ll",
"need",
"to",
"add",
"the",
"following",
"line",
"to",
"the",
"subclass",
"s",
"tearDown",
"()",
":",
"super",
"(",
"SubClassOfBaseCase",
"self",
")",
".",
... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L3286-L3483 | [
"def",
"tearDown",
"(",
"self",
")",
":",
"has_exception",
"=",
"False",
"if",
"sys",
".",
"version",
".",
"startswith",
"(",
"'3'",
")",
"and",
"hasattr",
"(",
"self",
",",
"'_outcome'",
")",
":",
"if",
"hasattr",
"(",
"self",
".",
"_outcome",
",",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | S3LoggingBucket.upload_file | Upload a given file from the file_path to the bucket
with the new name/path file_name. | seleniumbase/core/s3_manager.py | def upload_file(self, file_name, file_path):
""" Upload a given file from the file_path to the bucket
with the new name/path file_name. """
upload_key = Key(bucket=self.bucket, name=file_name)
content_type = "text/plain"
if file_name.endswith(".html"):
content_typ... | def upload_file(self, file_name, file_path):
""" Upload a given file from the file_path to the bucket
with the new name/path file_name. """
upload_key = Key(bucket=self.bucket, name=file_name)
content_type = "text/plain"
if file_name.endswith(".html"):
content_typ... | [
"Upload",
"a",
"given",
"file",
"from",
"the",
"file_path",
"to",
"the",
"bucket",
"with",
"the",
"new",
"name",
"/",
"path",
"file_name",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/s3_manager.py#L36-L55 | [
"def",
"upload_file",
"(",
"self",
",",
"file_name",
",",
"file_path",
")",
":",
"upload_key",
"=",
"Key",
"(",
"bucket",
"=",
"self",
".",
"bucket",
",",
"name",
"=",
"file_name",
")",
"content_type",
"=",
"\"text/plain\"",
"if",
"file_name",
".",
"endswi... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | S3LoggingBucket.upload_index_file | Create an index.html file with links to all the log files
that were just uploaded. | seleniumbase/core/s3_manager.py | def upload_index_file(self, test_address, timestamp):
""" Create an index.html file with links to all the log files
that were just uploaded. """
global already_uploaded_files
already_uploaded_files = list(set(already_uploaded_files))
already_uploaded_files.sort()
file... | def upload_index_file(self, test_address, timestamp):
""" Create an index.html file with links to all the log files
that were just uploaded. """
global already_uploaded_files
already_uploaded_files = list(set(already_uploaded_files))
already_uploaded_files.sort()
file... | [
"Create",
"an",
"index",
".",
"html",
"file",
"with",
"links",
"to",
"all",
"the",
"log",
"files",
"that",
"were",
"just",
"uploaded",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/s3_manager.py#L57-L73 | [
"def",
"upload_index_file",
"(",
"self",
",",
"test_address",
",",
"timestamp",
")",
":",
"global",
"already_uploaded_files",
"already_uploaded_files",
"=",
"list",
"(",
"set",
"(",
"already_uploaded_files",
")",
")",
"already_uploaded_files",
".",
"sort",
"(",
")",... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | activate_bootstrap | Allows you to use Bootstrap Tours with SeleniumBase
http://bootstraptour.com/ | seleniumbase/core/tour_helper.py | def activate_bootstrap(driver):
""" Allows you to use Bootstrap Tours with SeleniumBase
http://bootstraptour.com/
"""
bootstrap_tour_css = constants.BootstrapTour.MIN_CSS
bootstrap_tour_js = constants.BootstrapTour.MIN_JS
verify_script = ("""// Verify Bootstrap Tour activated
... | def activate_bootstrap(driver):
""" Allows you to use Bootstrap Tours with SeleniumBase
http://bootstraptour.com/
"""
bootstrap_tour_css = constants.BootstrapTour.MIN_CSS
bootstrap_tour_js = constants.BootstrapTour.MIN_JS
verify_script = ("""// Verify Bootstrap Tour activated
... | [
"Allows",
"you",
"to",
"use",
"Bootstrap",
"Tours",
"with",
"SeleniumBase",
"http",
":",
"//",
"bootstraptour",
".",
"com",
"/"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/tour_helper.py#L26-L54 | [
"def",
"activate_bootstrap",
"(",
"driver",
")",
":",
"bootstrap_tour_css",
"=",
"constants",
".",
"BootstrapTour",
".",
"MIN_CSS",
"bootstrap_tour_js",
"=",
"constants",
".",
"BootstrapTour",
".",
"MIN_JS",
"verify_script",
"=",
"(",
"\"\"\"// Verify Bootstrap Tour act... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | activate_hopscotch | Allows you to use Hopscotch Tours with SeleniumBase
http://linkedin.github.io/hopscotch/ | seleniumbase/core/tour_helper.py | def activate_hopscotch(driver):
""" Allows you to use Hopscotch Tours with SeleniumBase
http://linkedin.github.io/hopscotch/
"""
hopscotch_css = constants.Hopscotch.MIN_CSS
hopscotch_js = constants.Hopscotch.MIN_JS
backdrop_style = style_sheet.hops_backdrop_style
verify_script = ("""// ... | def activate_hopscotch(driver):
""" Allows you to use Hopscotch Tours with SeleniumBase
http://linkedin.github.io/hopscotch/
"""
hopscotch_css = constants.Hopscotch.MIN_CSS
hopscotch_js = constants.Hopscotch.MIN_JS
backdrop_style = style_sheet.hops_backdrop_style
verify_script = ("""// ... | [
"Allows",
"you",
"to",
"use",
"Hopscotch",
"Tours",
"with",
"SeleniumBase",
"http",
":",
"//",
"linkedin",
".",
"github",
".",
"io",
"/",
"hopscotch",
"/"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/tour_helper.py#L68-L99 | [
"def",
"activate_hopscotch",
"(",
"driver",
")",
":",
"hopscotch_css",
"=",
"constants",
".",
"Hopscotch",
".",
"MIN_CSS",
"hopscotch_js",
"=",
"constants",
".",
"Hopscotch",
".",
"MIN_JS",
"backdrop_style",
"=",
"style_sheet",
".",
"hops_backdrop_style",
"verify_sc... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | activate_introjs | Allows you to use IntroJS Tours with SeleniumBase
https://introjs.com/ | seleniumbase/core/tour_helper.py | def activate_introjs(driver):
""" Allows you to use IntroJS Tours with SeleniumBase
https://introjs.com/
"""
intro_css = constants.IntroJS.MIN_CSS
intro_js = constants.IntroJS.MIN_JS
verify_script = ("""// Verify IntroJS activated
var intro2 = introJs();
... | def activate_introjs(driver):
""" Allows you to use IntroJS Tours with SeleniumBase
https://introjs.com/
"""
intro_css = constants.IntroJS.MIN_CSS
intro_js = constants.IntroJS.MIN_JS
verify_script = ("""// Verify IntroJS activated
var intro2 = introJs();
... | [
"Allows",
"you",
"to",
"use",
"IntroJS",
"Tours",
"with",
"SeleniumBase",
"https",
":",
"//",
"introjs",
".",
"com",
"/"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/tour_helper.py#L113-L142 | [
"def",
"activate_introjs",
"(",
"driver",
")",
":",
"intro_css",
"=",
"constants",
".",
"IntroJS",
".",
"MIN_CSS",
"intro_js",
"=",
"constants",
".",
"IntroJS",
".",
"MIN_JS",
"verify_script",
"=",
"(",
"\"\"\"// Verify IntroJS activated\n var intro2... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | activate_shepherd | Allows you to use Shepherd Tours with SeleniumBase
http://github.hubspot.com/shepherd/docs/welcome/ | seleniumbase/core/tour_helper.py | def activate_shepherd(driver):
""" Allows you to use Shepherd Tours with SeleniumBase
http://github.hubspot.com/shepherd/docs/welcome/
"""
shepherd_js = constants.Shepherd.MIN_JS
sh_theme_arrows_css = constants.Shepherd.THEME_ARROWS_CSS
sh_theme_arrows_fix_css = constants.Shepherd.THEME_ARR_... | def activate_shepherd(driver):
""" Allows you to use Shepherd Tours with SeleniumBase
http://github.hubspot.com/shepherd/docs/welcome/
"""
shepherd_js = constants.Shepherd.MIN_JS
sh_theme_arrows_css = constants.Shepherd.THEME_ARROWS_CSS
sh_theme_arrows_fix_css = constants.Shepherd.THEME_ARR_... | [
"Allows",
"you",
"to",
"use",
"Shepherd",
"Tours",
"with",
"SeleniumBase",
"http",
":",
"//",
"github",
".",
"hubspot",
".",
"com",
"/",
"shepherd",
"/",
"docs",
"/",
"welcome",
"/"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/tour_helper.py#L156-L202 | [
"def",
"activate_shepherd",
"(",
"driver",
")",
":",
"shepherd_js",
"=",
"constants",
".",
"Shepherd",
".",
"MIN_JS",
"sh_theme_arrows_css",
"=",
"constants",
".",
"Shepherd",
".",
"THEME_ARROWS_CSS",
"sh_theme_arrows_fix_css",
"=",
"constants",
".",
"Shepherd",
"."... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | play_shepherd_tour | Plays a Shepherd tour on the current website. | seleniumbase/core/tour_helper.py | def play_shepherd_tour(driver, tour_steps, msg_dur, name=None, interval=0):
""" Plays a Shepherd tour on the current website. """
instructions = ""
for tour_step in tour_steps[name]:
instructions += tour_step
instructions += ("""
// Start the tour
tour.start();
$tour = to... | def play_shepherd_tour(driver, tour_steps, msg_dur, name=None, interval=0):
""" Plays a Shepherd tour on the current website. """
instructions = ""
for tour_step in tour_steps[name]:
instructions += tour_step
instructions += ("""
// Start the tour
tour.start();
$tour = to... | [
"Plays",
"a",
"Shepherd",
"tour",
"on",
"the",
"current",
"website",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/tour_helper.py#L214-L323 | [
"def",
"play_shepherd_tour",
"(",
"driver",
",",
"tour_steps",
",",
"msg_dur",
",",
"name",
"=",
"None",
",",
"interval",
"=",
"0",
")",
":",
"instructions",
"=",
"\"\"",
"for",
"tour_step",
"in",
"tour_steps",
"[",
"name",
"]",
":",
"instructions",
"+=",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | play_bootstrap_tour | Plays a Bootstrap tour on the current website. | seleniumbase/core/tour_helper.py | def play_bootstrap_tour(
driver, tour_steps, browser, msg_dur, name=None, interval=0):
""" Plays a Bootstrap tour on the current website. """
instructions = ""
for tour_step in tour_steps[name]:
instructions += tour_step
instructions += (
"""]);
// Initialize the tour
... | def play_bootstrap_tour(
driver, tour_steps, browser, msg_dur, name=None, interval=0):
""" Plays a Bootstrap tour on the current website. """
instructions = ""
for tour_step in tour_steps[name]:
instructions += tour_step
instructions += (
"""]);
// Initialize the tour
... | [
"Plays",
"a",
"Bootstrap",
"tour",
"on",
"the",
"current",
"website",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/tour_helper.py#L326-L408 | [
"def",
"play_bootstrap_tour",
"(",
"driver",
",",
"tour_steps",
",",
"browser",
",",
"msg_dur",
",",
"name",
"=",
"None",
",",
"interval",
"=",
"0",
")",
":",
"instructions",
"=",
"\"\"",
"for",
"tour_step",
"in",
"tour_steps",
"[",
"name",
"]",
":",
"in... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | play_introjs_tour | Plays an IntroJS tour on the current website. | seleniumbase/core/tour_helper.py | def play_introjs_tour(
driver, tour_steps, browser, msg_dur, name=None, interval=0):
""" Plays an IntroJS tour on the current website. """
instructions = ""
for tour_step in tour_steps[name]:
instructions += tour_step
instructions += (
"""]
});
intro.setOption("di... | def play_introjs_tour(
driver, tour_steps, browser, msg_dur, name=None, interval=0):
""" Plays an IntroJS tour on the current website. """
instructions = ""
for tour_step in tour_steps[name]:
instructions += tour_step
instructions += (
"""]
});
intro.setOption("di... | [
"Plays",
"an",
"IntroJS",
"tour",
"on",
"the",
"current",
"website",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/tour_helper.py#L519-L634 | [
"def",
"play_introjs_tour",
"(",
"driver",
",",
"tour_steps",
",",
"browser",
",",
"msg_dur",
",",
"name",
"=",
"None",
",",
"interval",
"=",
"0",
")",
":",
"instructions",
"=",
"\"\"",
"for",
"tour_step",
"in",
"tour_steps",
"[",
"name",
"]",
":",
"inst... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | export_tour | Exports a tour as a JS file.
It will include necessary resources as well, such as jQuery.
You'll be able to copy the tour directly into the Console of
any web browser to play the tour outside of SeleniumBase runs. | seleniumbase/core/tour_helper.py | def export_tour(tour_steps, name=None, filename="my_tour.js", url=None):
""" Exports a tour as a JS file.
It will include necessary resources as well, such as jQuery.
You'll be able to copy the tour directly into the Console of
any web browser to play the tour outside of SeleniumBase runs. "... | def export_tour(tour_steps, name=None, filename="my_tour.js", url=None):
""" Exports a tour as a JS file.
It will include necessary resources as well, such as jQuery.
You'll be able to copy the tour directly into the Console of
any web browser to play the tour outside of SeleniumBase runs. "... | [
"Exports",
"a",
"tour",
"as",
"a",
"JS",
"file",
".",
"It",
"will",
"include",
"necessary",
"resources",
"as",
"well",
"such",
"as",
"jQuery",
".",
"You",
"ll",
"be",
"able",
"to",
"copy",
"the",
"tour",
"directly",
"into",
"the",
"Console",
"of",
"any... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/tour_helper.py#L637-L809 | [
"def",
"export_tour",
"(",
"tour_steps",
",",
"name",
"=",
"None",
",",
"filename",
"=",
"\"my_tour.js\"",
",",
"url",
"=",
"None",
")",
":",
"if",
"not",
"name",
":",
"name",
"=",
"\"default\"",
"if",
"name",
"not",
"in",
"tour_steps",
":",
"raise",
"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | reset_downloads_folder | Clears the downloads folder.
If settings.ARCHIVE_EXISTING_DOWNLOADS is set to True, archives it. | seleniumbase/core/download_helper.py | def reset_downloads_folder():
''' Clears the downloads folder.
If settings.ARCHIVE_EXISTING_DOWNLOADS is set to True, archives it. '''
if os.path.exists(downloads_path) and not os.listdir(downloads_path) == []:
archived_downloads_folder = os.path.join(downloads_path, '..',
... | def reset_downloads_folder():
''' Clears the downloads folder.
If settings.ARCHIVE_EXISTING_DOWNLOADS is set to True, archives it. '''
if os.path.exists(downloads_path) and not os.listdir(downloads_path) == []:
archived_downloads_folder = os.path.join(downloads_path, '..',
... | [
"Clears",
"the",
"downloads",
"folder",
".",
"If",
"settings",
".",
"ARCHIVE_EXISTING_DOWNLOADS",
"is",
"set",
"to",
"True",
"archives",
"it",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/download_helper.py#L23-L33 | [
"def",
"reset_downloads_folder",
"(",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"downloads_path",
")",
"and",
"not",
"os",
".",
"listdir",
"(",
"downloads_path",
")",
"==",
"[",
"]",
":",
"archived_downloads_folder",
"=",
"os",
".",
"path",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | is_element_present | Returns whether the specified element selector is present on the page.
@Params
driver - the webdriver object (required)
selector - the locator that is used (required)
by - the method to search for the locator (Default: By.CSS_SELECTOR)
@Returns
Boolean (is element present) | seleniumbase/fixtures/page_actions.py | def is_element_present(driver, selector, by=By.CSS_SELECTOR):
"""
Returns whether the specified element selector is present on the page.
@Params
driver - the webdriver object (required)
selector - the locator that is used (required)
by - the method to search for the locator (Default: By.CSS_SELE... | def is_element_present(driver, selector, by=By.CSS_SELECTOR):
"""
Returns whether the specified element selector is present on the page.
@Params
driver - the webdriver object (required)
selector - the locator that is used (required)
by - the method to search for the locator (Default: By.CSS_SELE... | [
"Returns",
"whether",
"the",
"specified",
"element",
"selector",
"is",
"present",
"on",
"the",
"page",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_actions.py#L37-L51 | [
"def",
"is_element_present",
"(",
"driver",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
")",
":",
"try",
":",
"driver",
".",
"find_element",
"(",
"by",
"=",
"by",
",",
"value",
"=",
"selector",
")",
"return",
"True",
"except",
"Exception"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | is_element_visible | Returns whether the specified element selector is visible on the page.
@Params
driver - the webdriver object (required)
selector - the locator that is used (required)
by - the method to search for the locator (Default: By.CSS_SELECTOR)
@Returns
Boolean (is element visible) | seleniumbase/fixtures/page_actions.py | def is_element_visible(driver, selector, by=By.CSS_SELECTOR):
"""
Returns whether the specified element selector is visible on the page.
@Params
driver - the webdriver object (required)
selector - the locator that is used (required)
by - the method to search for the locator (Default: By.CSS_SELE... | def is_element_visible(driver, selector, by=By.CSS_SELECTOR):
"""
Returns whether the specified element selector is visible on the page.
@Params
driver - the webdriver object (required)
selector - the locator that is used (required)
by - the method to search for the locator (Default: By.CSS_SELE... | [
"Returns",
"whether",
"the",
"specified",
"element",
"selector",
"is",
"visible",
"on",
"the",
"page",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_actions.py#L54-L68 | [
"def",
"is_element_visible",
"(",
"driver",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
")",
":",
"try",
":",
"element",
"=",
"driver",
".",
"find_element",
"(",
"by",
"=",
"by",
",",
"value",
"=",
"selector",
")",
"return",
"element",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | is_text_visible | Returns whether the specified text is visible in the specified selector.
@Params
driver - the webdriver object (required)
text - the text string to search for
selector - the locator that is used (required)
by - the method to search for the locator (Default: By.CSS_SELECTOR)
@Returns
Boolean ... | seleniumbase/fixtures/page_actions.py | def is_text_visible(driver, text, selector, by=By.CSS_SELECTOR):
"""
Returns whether the specified text is visible in the specified selector.
@Params
driver - the webdriver object (required)
text - the text string to search for
selector - the locator that is used (required)
by - the method t... | def is_text_visible(driver, text, selector, by=By.CSS_SELECTOR):
"""
Returns whether the specified text is visible in the specified selector.
@Params
driver - the webdriver object (required)
text - the text string to search for
selector - the locator that is used (required)
by - the method t... | [
"Returns",
"whether",
"the",
"specified",
"text",
"is",
"visible",
"in",
"the",
"specified",
"selector",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_actions.py#L71-L86 | [
"def",
"is_text_visible",
"(",
"driver",
",",
"text",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
")",
":",
"try",
":",
"element",
"=",
"driver",
".",
"find_element",
"(",
"by",
"=",
"by",
",",
"value",
"=",
"selector",
")",
"return",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | hover_on_element | Fires the hover event for the specified element by the given selector.
@Params
driver - the webdriver object (required)
selector - the locator (css selector) that is used (required)
by - the method to search for the locator (Default: By.CSS_SELECTOR) | seleniumbase/fixtures/page_actions.py | def hover_on_element(driver, selector, by=By.CSS_SELECTOR):
"""
Fires the hover event for the specified element by the given selector.
@Params
driver - the webdriver object (required)
selector - the locator (css selector) that is used (required)
by - the method to search for the locator (Default... | def hover_on_element(driver, selector, by=By.CSS_SELECTOR):
"""
Fires the hover event for the specified element by the given selector.
@Params
driver - the webdriver object (required)
selector - the locator (css selector) that is used (required)
by - the method to search for the locator (Default... | [
"Fires",
"the",
"hover",
"event",
"for",
"the",
"specified",
"element",
"by",
"the",
"given",
"selector",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_actions.py#L89-L99 | [
"def",
"hover_on_element",
"(",
"driver",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
")",
":",
"element",
"=",
"driver",
".",
"find_element",
"(",
"by",
"=",
"by",
",",
"value",
"=",
"selector",
")",
"hover",
"=",
"ActionChains",
"(",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | hover_element_and_click | Similar to hover_and_click(), but assumes top element is already found. | seleniumbase/fixtures/page_actions.py | def hover_element_and_click(driver, element, click_selector,
click_by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
"""
Similar to hover_and_click(), but assumes top element is already found.
"""
start_ms = time.time() * 1000.0
stop_ms = st... | def hover_element_and_click(driver, element, click_selector,
click_by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
"""
Similar to hover_and_click(), but assumes top element is already found.
"""
start_ms = time.time() * 1000.0
stop_ms = st... | [
"Similar",
"to",
"hover_and_click",
"()",
"but",
"assumes",
"top",
"element",
"is",
"already",
"found",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_actions.py#L136-L158 | [
"def",
"hover_element_and_click",
"(",
"driver",
",",
"element",
",",
"click_selector",
",",
"click_by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"start_ms",
"=",
"time",
".",
"time",
"(",
")",
"*",
"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | wait_for_element_present | Searches for the specified element by the given selector. Returns the
element object if the element is present on the page. The element can be
invisible. Raises an exception if the element does not appear in the
specified timeout.
@Params
driver - the webdriver object
selector - the locator that... | seleniumbase/fixtures/page_actions.py | def wait_for_element_present(driver, selector, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
"""
Searches for the specified element by the given selector. Returns the
element object if the element is present on the page. The element can be
invisible. Raises an excepti... | def wait_for_element_present(driver, selector, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
"""
Searches for the specified element by the given selector. Returns the
element object if the element is present on the page. The element can be
invisible. Raises an excepti... | [
"Searches",
"for",
"the",
"specified",
"element",
"by",
"the",
"given",
"selector",
".",
"Returns",
"the",
"element",
"object",
"if",
"the",
"element",
"is",
"present",
"on",
"the",
"page",
".",
"The",
"element",
"can",
"be",
"invisible",
".",
"Raises",
"a... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_actions.py#L161-L192 | [
"def",
"wait_for_element_present",
"(",
"driver",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT",
")",
":",
"element",
"=",
"None",
"start_ms",
"=",
"time",
".",
"time",
"(",
")",
"*",
"1... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | wait_for_element_visible | Searches for the specified element by the given selector. Returns the
element object if the element is present and visible on the page.
Raises an exception if the element does not appear in the
specified timeout.
@Params
driver - the webdriver object (required)
selector - the locator that is use... | seleniumbase/fixtures/page_actions.py | def wait_for_element_visible(driver, selector, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
"""
Searches for the specified element by the given selector. Returns the
element object if the element is present and visible on the page.
Raises an exception if the element ... | def wait_for_element_visible(driver, selector, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
"""
Searches for the specified element by the given selector. Returns the
element object if the element is present and visible on the page.
Raises an exception if the element ... | [
"Searches",
"for",
"the",
"specified",
"element",
"by",
"the",
"given",
"selector",
".",
"Returns",
"the",
"element",
"object",
"if",
"the",
"element",
"is",
"present",
"and",
"visible",
"on",
"the",
"page",
".",
"Raises",
"an",
"exception",
"if",
"the",
"... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_actions.py#L195-L238 | [
"def",
"wait_for_element_visible",
"(",
"driver",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT",
")",
":",
"element",
"=",
"None",
"start_ms",
"=",
"time",
".",
"time",
"(",
")",
"*",
"1... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | find_visible_elements | Finds all WebElements that match a selector and are visible.
Similar to webdriver.find_elements.
@Params
driver - the webdriver object (required)
selector - the locator that is used to search the DOM (required)
by - the method to search for the locator (Default: By.CSS_SELECTOR) | seleniumbase/fixtures/page_actions.py | def find_visible_elements(driver, selector, by=By.CSS_SELECTOR):
"""
Finds all WebElements that match a selector and are visible.
Similar to webdriver.find_elements.
@Params
driver - the webdriver object (required)
selector - the locator that is used to search the DOM (required)
by - the met... | def find_visible_elements(driver, selector, by=By.CSS_SELECTOR):
"""
Finds all WebElements that match a selector and are visible.
Similar to webdriver.find_elements.
@Params
driver - the webdriver object (required)
selector - the locator that is used to search the DOM (required)
by - the met... | [
"Finds",
"all",
"WebElements",
"that",
"match",
"a",
"selector",
"and",
"are",
"visible",
".",
"Similar",
"to",
"webdriver",
".",
"find_elements",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_actions.py#L392-L402 | [
"def",
"find_visible_elements",
"(",
"driver",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
")",
":",
"elements",
"=",
"driver",
".",
"find_elements",
"(",
"by",
"=",
"by",
",",
"value",
"=",
"selector",
")",
"return",
"[",
"element",
"for... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | save_screenshot | Saves a screenshot to the current directory (or to a subfolder if provided)
If the folder provided doesn't exist, it will get created.
The screenshot will be in PNG format. | seleniumbase/fixtures/page_actions.py | def save_screenshot(driver, name, folder=None):
"""
Saves a screenshot to the current directory (or to a subfolder if provided)
If the folder provided doesn't exist, it will get created.
The screenshot will be in PNG format.
"""
if "." not in name:
name = name + ".png"
if folder:
... | def save_screenshot(driver, name, folder=None):
"""
Saves a screenshot to the current directory (or to a subfolder if provided)
If the folder provided doesn't exist, it will get created.
The screenshot will be in PNG format.
"""
if "." not in name:
name = name + ".png"
if folder:
... | [
"Saves",
"a",
"screenshot",
"to",
"the",
"current",
"directory",
"(",
"or",
"to",
"a",
"subfolder",
"if",
"provided",
")",
"If",
"the",
"folder",
"provided",
"doesn",
"t",
"exist",
"it",
"will",
"get",
"created",
".",
"The",
"screenshot",
"will",
"be",
"... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_actions.py#L405-L430 | [
"def",
"save_screenshot",
"(",
"driver",
",",
"name",
",",
"folder",
"=",
"None",
")",
":",
"if",
"\".\"",
"not",
"in",
"name",
":",
"name",
"=",
"name",
"+",
"\".png\"",
"if",
"folder",
":",
"abs_path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | wait_for_and_accept_alert | Wait for and accept an alert. Returns the text from the alert.
@Params
driver - the webdriver object (required)
timeout - the time to wait for the alert in seconds | seleniumbase/fixtures/page_actions.py | def wait_for_and_accept_alert(driver, timeout=settings.LARGE_TIMEOUT):
"""
Wait for and accept an alert. Returns the text from the alert.
@Params
driver - the webdriver object (required)
timeout - the time to wait for the alert in seconds
"""
alert = wait_for_and_switch_to_alert(driver, time... | def wait_for_and_accept_alert(driver, timeout=settings.LARGE_TIMEOUT):
"""
Wait for and accept an alert. Returns the text from the alert.
@Params
driver - the webdriver object (required)
timeout - the time to wait for the alert in seconds
"""
alert = wait_for_and_switch_to_alert(driver, time... | [
"Wait",
"for",
"and",
"accept",
"an",
"alert",
".",
"Returns",
"the",
"text",
"from",
"the",
"alert",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_actions.py#L469-L479 | [
"def",
"wait_for_and_accept_alert",
"(",
"driver",
",",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT",
")",
":",
"alert",
"=",
"wait_for_and_switch_to_alert",
"(",
"driver",
",",
"timeout",
")",
"alert_text",
"=",
"alert",
".",
"text",
"alert",
".",
"accept",... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | wait_for_and_dismiss_alert | Wait for and dismiss an alert. Returns the text from the alert.
@Params
driver - the webdriver object (required)
timeout - the time to wait for the alert in seconds | seleniumbase/fixtures/page_actions.py | def wait_for_and_dismiss_alert(driver, timeout=settings.LARGE_TIMEOUT):
"""
Wait for and dismiss an alert. Returns the text from the alert.
@Params
driver - the webdriver object (required)
timeout - the time to wait for the alert in seconds
"""
alert = wait_for_and_switch_to_alert(driver, ti... | def wait_for_and_dismiss_alert(driver, timeout=settings.LARGE_TIMEOUT):
"""
Wait for and dismiss an alert. Returns the text from the alert.
@Params
driver - the webdriver object (required)
timeout - the time to wait for the alert in seconds
"""
alert = wait_for_and_switch_to_alert(driver, ti... | [
"Wait",
"for",
"and",
"dismiss",
"an",
"alert",
".",
"Returns",
"the",
"text",
"from",
"the",
"alert",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_actions.py#L482-L492 | [
"def",
"wait_for_and_dismiss_alert",
"(",
"driver",
",",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT",
")",
":",
"alert",
"=",
"wait_for_and_switch_to_alert",
"(",
"driver",
",",
"timeout",
")",
"alert_text",
"=",
"alert",
".",
"text",
"alert",
".",
"dismiss... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | wait_for_and_switch_to_alert | Wait for a browser alert to appear, and switch to it. This should be usable
as a drop-in replacement for driver.switch_to.alert when the alert box
may not exist yet.
@Params
driver - the webdriver object (required)
timeout - the time to wait for the alert in seconds | seleniumbase/fixtures/page_actions.py | def wait_for_and_switch_to_alert(driver, timeout=settings.LARGE_TIMEOUT):
"""
Wait for a browser alert to appear, and switch to it. This should be usable
as a drop-in replacement for driver.switch_to.alert when the alert box
may not exist yet.
@Params
driver - the webdriver object (required)
... | def wait_for_and_switch_to_alert(driver, timeout=settings.LARGE_TIMEOUT):
"""
Wait for a browser alert to appear, and switch to it. This should be usable
as a drop-in replacement for driver.switch_to.alert when the alert box
may not exist yet.
@Params
driver - the webdriver object (required)
... | [
"Wait",
"for",
"a",
"browser",
"alert",
"to",
"appear",
"and",
"switch",
"to",
"it",
".",
"This",
"should",
"be",
"usable",
"as",
"a",
"drop",
"-",
"in",
"replacement",
"for",
"driver",
".",
"switch_to",
".",
"alert",
"when",
"the",
"alert",
"box",
"ma... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_actions.py#L495-L518 | [
"def",
"wait_for_and_switch_to_alert",
"(",
"driver",
",",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT",
")",
":",
"start_ms",
"=",
"time",
".",
"time",
"(",
")",
"*",
"1000.0",
"stop_ms",
"=",
"start_ms",
"+",
"(",
"timeout",
"*",
"1000.0",
")",
"for"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | switch_to_frame | Wait for an iframe to appear, and switch to it. This should be usable
as a drop-in replacement for driver.switch_to.frame().
@Params
driver - the webdriver object (required)
frame - the frame element, name, or index
timeout - the time to wait for the alert in seconds | seleniumbase/fixtures/page_actions.py | def switch_to_frame(driver, frame, timeout=settings.SMALL_TIMEOUT):
"""
Wait for an iframe to appear, and switch to it. This should be usable
as a drop-in replacement for driver.switch_to.frame().
@Params
driver - the webdriver object (required)
frame - the frame element, name, or index
time... | def switch_to_frame(driver, frame, timeout=settings.SMALL_TIMEOUT):
"""
Wait for an iframe to appear, and switch to it. This should be usable
as a drop-in replacement for driver.switch_to.frame().
@Params
driver - the webdriver object (required)
frame - the frame element, name, or index
time... | [
"Wait",
"for",
"an",
"iframe",
"to",
"appear",
"and",
"switch",
"to",
"it",
".",
"This",
"should",
"be",
"usable",
"as",
"a",
"drop",
"-",
"in",
"replacement",
"for",
"driver",
".",
"switch_to",
".",
"frame",
"()",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_actions.py#L521-L542 | [
"def",
"switch_to_frame",
"(",
"driver",
",",
"frame",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"start_ms",
"=",
"time",
".",
"time",
"(",
")",
"*",
"1000.0",
"stop_ms",
"=",
"start_ms",
"+",
"(",
"timeout",
"*",
"1000.0",
")",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | switch_to_window | Wait for a window to appear, and switch to it. This should be usable
as a drop-in replacement for driver.switch_to.window().
@Params
driver - the webdriver object (required)
window - the window index or window handle
timeout - the time to wait for the window in seconds | seleniumbase/fixtures/page_actions.py | def switch_to_window(driver, window, timeout=settings.SMALL_TIMEOUT):
"""
Wait for a window to appear, and switch to it. This should be usable
as a drop-in replacement for driver.switch_to.window().
@Params
driver - the webdriver object (required)
window - the window index or window handle
t... | def switch_to_window(driver, window, timeout=settings.SMALL_TIMEOUT):
"""
Wait for a window to appear, and switch to it. This should be usable
as a drop-in replacement for driver.switch_to.window().
@Params
driver - the webdriver object (required)
window - the window index or window handle
t... | [
"Wait",
"for",
"a",
"window",
"to",
"appear",
"and",
"switch",
"to",
"it",
".",
"This",
"should",
"be",
"usable",
"as",
"a",
"drop",
"-",
"in",
"replacement",
"for",
"driver",
".",
"switch_to",
".",
"window",
"()",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_actions.py#L545-L580 | [
"def",
"switch_to_window",
"(",
"driver",
",",
"window",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"start_ms",
"=",
"time",
".",
"time",
"(",
")",
"*",
"1000.0",
"stop_ms",
"=",
"start_ms",
"+",
"(",
"timeout",
"*",
"1000.0",
")",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | get_domain_url | Use this to convert a url like this:
https://blog.xkcd.com/2014/07/22/what-if-book-tour/
Into this:
https://blog.xkcd.com | seleniumbase/fixtures/page_utils.py | def get_domain_url(url):
"""
Use this to convert a url like this:
https://blog.xkcd.com/2014/07/22/what-if-book-tour/
Into this:
https://blog.xkcd.com
"""
if "http://" not in url and "https://" not in url:
return url
url_header = url.split('://')[0]
simple_url = url.split(':/... | def get_domain_url(url):
"""
Use this to convert a url like this:
https://blog.xkcd.com/2014/07/22/what-if-book-tour/
Into this:
https://blog.xkcd.com
"""
if "http://" not in url and "https://" not in url:
return url
url_header = url.split('://')[0]
simple_url = url.split(':/... | [
"Use",
"this",
"to",
"convert",
"a",
"url",
"like",
"this",
":",
"https",
":",
"//",
"blog",
".",
"xkcd",
".",
"com",
"/",
"2014",
"/",
"07",
"/",
"22",
"/",
"what",
"-",
"if",
"-",
"book",
"-",
"tour",
"/",
"Into",
"this",
":",
"https",
":",
... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_utils.py#L9-L22 | [
"def",
"get_domain_url",
"(",
"url",
")",
":",
"if",
"\"http://\"",
"not",
"in",
"url",
"and",
"\"https://\"",
"not",
"in",
"url",
":",
"return",
"url",
"url_header",
"=",
"url",
".",
"split",
"(",
"'://'",
")",
"[",
"0",
"]",
"simple_url",
"=",
"url",... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | is_xpath_selector | A basic method to determine if a selector is an xpath selector. | seleniumbase/fixtures/page_utils.py | def is_xpath_selector(selector):
"""
A basic method to determine if a selector is an xpath selector.
"""
if (selector.startswith('/') or selector.startswith('./') or (
selector.startswith('('))):
return True
return False | def is_xpath_selector(selector):
"""
A basic method to determine if a selector is an xpath selector.
"""
if (selector.startswith('/') or selector.startswith('./') or (
selector.startswith('('))):
return True
return False | [
"A",
"basic",
"method",
"to",
"determine",
"if",
"a",
"selector",
"is",
"an",
"xpath",
"selector",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_utils.py#L25-L32 | [
"def",
"is_xpath_selector",
"(",
"selector",
")",
":",
"if",
"(",
"selector",
".",
"startswith",
"(",
"'/'",
")",
"or",
"selector",
".",
"startswith",
"(",
"'./'",
")",
"or",
"(",
"selector",
".",
"startswith",
"(",
"'('",
")",
")",
")",
":",
"return",... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | get_link_text_from_selector | A basic method to get the link text from a link text selector. | seleniumbase/fixtures/page_utils.py | def get_link_text_from_selector(selector):
"""
A basic method to get the link text from a link text selector.
"""
if selector.startswith('link='):
return selector.split('link=')[1]
elif selector.startswith('link_text='):
return selector.split('link_text=')[1]
return selector | def get_link_text_from_selector(selector):
"""
A basic method to get the link text from a link text selector.
"""
if selector.startswith('link='):
return selector.split('link=')[1]
elif selector.startswith('link_text='):
return selector.split('link_text=')[1]
return selector | [
"A",
"basic",
"method",
"to",
"get",
"the",
"link",
"text",
"from",
"a",
"link",
"text",
"selector",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_utils.py#L44-L52 | [
"def",
"get_link_text_from_selector",
"(",
"selector",
")",
":",
"if",
"selector",
".",
"startswith",
"(",
"'link='",
")",
":",
"return",
"selector",
".",
"split",
"(",
"'link='",
")",
"[",
"1",
"]",
"elif",
"selector",
".",
"startswith",
"(",
"'link_text='"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | _get_unique_links | Returns all unique links.
Includes:
"a"->"href", "img"->"src", "link"->"href", and "script"->"src" links. | seleniumbase/fixtures/page_utils.py | def _get_unique_links(page_url, soup):
"""
Returns all unique links.
Includes:
"a"->"href", "img"->"src", "link"->"href", and "script"->"src" links.
"""
if "http://" not in page_url and "https://" not in page_url:
return []
prefix = 'http:'
if page_url.startswith('https:'):
... | def _get_unique_links(page_url, soup):
"""
Returns all unique links.
Includes:
"a"->"href", "img"->"src", "link"->"href", and "script"->"src" links.
"""
if "http://" not in page_url and "https://" not in page_url:
return []
prefix = 'http:'
if page_url.startswith('https:'):
... | [
"Returns",
"all",
"unique",
"links",
".",
"Includes",
":",
"a",
"-",
">",
"href",
"img",
"-",
">",
"src",
"link",
"-",
">",
"href",
"and",
"script",
"-",
">",
"src",
"links",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_utils.py#L70-L129 | [
"def",
"_get_unique_links",
"(",
"page_url",
",",
"soup",
")",
":",
"if",
"\"http://\"",
"not",
"in",
"page_url",
"and",
"\"https://\"",
"not",
"in",
"page_url",
":",
"return",
"[",
"]",
"prefix",
"=",
"'http:'",
"if",
"page_url",
".",
"startswith",
"(",
"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | _get_link_status_code | Get the status code of a link.
If the timeout is exceeded, will return a 404.
For a list of available status codes, see:
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes | seleniumbase/fixtures/page_utils.py | def _get_link_status_code(link, allow_redirects=False, timeout=5):
""" Get the status code of a link.
If the timeout is exceeded, will return a 404.
For a list of available status codes, see:
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
"""
status_code = None
try:
... | def _get_link_status_code(link, allow_redirects=False, timeout=5):
""" Get the status code of a link.
If the timeout is exceeded, will return a 404.
For a list of available status codes, see:
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
"""
status_code = None
try:
... | [
"Get",
"the",
"status",
"code",
"of",
"a",
"link",
".",
"If",
"the",
"timeout",
"is",
"exceeded",
"will",
"return",
"a",
"404",
".",
"For",
"a",
"list",
"of",
"available",
"status",
"codes",
"see",
":",
"https",
":",
"//",
"en",
".",
"wikipedia",
"."... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_utils.py#L132-L145 | [
"def",
"_get_link_status_code",
"(",
"link",
",",
"allow_redirects",
"=",
"False",
",",
"timeout",
"=",
"5",
")",
":",
"status_code",
"=",
"None",
"try",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"link",
",",
"allow_redirects",
"=",
"allow_redirects... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | _print_unique_links_with_status_codes | Finds all unique links in the html of the page source
and then prints out those links with their status codes.
Format: ["link" -> "status_code"] (per line)
Page links include those obtained from:
"a"->"href", "img"->"src", "link"->"href", and "script"->"src". | seleniumbase/fixtures/page_utils.py | def _print_unique_links_with_status_codes(page_url, soup):
""" Finds all unique links in the html of the page source
and then prints out those links with their status codes.
Format: ["link" -> "status_code"] (per line)
Page links include those obtained from:
"a"->"href", "img"->"... | def _print_unique_links_with_status_codes(page_url, soup):
""" Finds all unique links in the html of the page source
and then prints out those links with their status codes.
Format: ["link" -> "status_code"] (per line)
Page links include those obtained from:
"a"->"href", "img"->"... | [
"Finds",
"all",
"unique",
"links",
"in",
"the",
"html",
"of",
"the",
"page",
"source",
"and",
"then",
"prints",
"out",
"those",
"links",
"with",
"their",
"status",
"codes",
".",
"Format",
":",
"[",
"link",
"-",
">",
"status_code",
"]",
"(",
"per",
"lin... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_utils.py#L148-L158 | [
"def",
"_print_unique_links_with_status_codes",
"(",
"page_url",
",",
"soup",
")",
":",
"links",
"=",
"_get_unique_links",
"(",
"page_url",
",",
"soup",
")",
"for",
"link",
"in",
"links",
":",
"status_code",
"=",
"_get_link_status_code",
"(",
"link",
")",
"print... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | retry_on_exception | Decorator for implementing exponential backoff for retrying on failures.
tries: Max number of tries to execute the wrapped function before failing.
delay: Delay time in seconds before the FIRST retry.
backoff: Multiplier to extend the initial delay by for each retry.
max_delay: Max time in seconds to w... | seleniumbase/common/decorators.py | def retry_on_exception(tries=6, delay=1, backoff=2, max_delay=32):
'''
Decorator for implementing exponential backoff for retrying on failures.
tries: Max number of tries to execute the wrapped function before failing.
delay: Delay time in seconds before the FIRST retry.
backoff: Multiplier to exte... | def retry_on_exception(tries=6, delay=1, backoff=2, max_delay=32):
'''
Decorator for implementing exponential backoff for retrying on failures.
tries: Max number of tries to execute the wrapped function before failing.
delay: Delay time in seconds before the FIRST retry.
backoff: Multiplier to exte... | [
"Decorator",
"for",
"implementing",
"exponential",
"backoff",
"for",
"retrying",
"on",
"failures",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/common/decorators.py#L10-L46 | [
"def",
"retry_on_exception",
"(",
"tries",
"=",
"6",
",",
"delay",
"=",
"1",
",",
"backoff",
"=",
"2",
",",
"max_delay",
"=",
"32",
")",
":",
"tries",
"=",
"math",
".",
"floor",
"(",
"tries",
")",
"if",
"tries",
"<",
"1",
":",
"raise",
"ValueError"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | rate_limited | This decorator limits how often a method can get called in a second.
If the limit is exceeded, the call will be held in a queue until
enough time has passed.
Useful when trying to avoid overloading a system with rapid calls. | seleniumbase/common/decorators.py | def rate_limited(max_per_second):
""" This decorator limits how often a method can get called in a second.
If the limit is exceeded, the call will be held in a queue until
enough time has passed.
Useful when trying to avoid overloading a system with rapid calls. """
min_interval = 1.0 / ... | def rate_limited(max_per_second):
""" This decorator limits how often a method can get called in a second.
If the limit is exceeded, the call will be held in a queue until
enough time has passed.
Useful when trying to avoid overloading a system with rapid calls. """
min_interval = 1.0 / ... | [
"This",
"decorator",
"limits",
"how",
"often",
"a",
"method",
"can",
"get",
"called",
"in",
"a",
"second",
".",
"If",
"the",
"limit",
"is",
"exceeded",
"the",
"call",
"will",
"be",
"held",
"in",
"a",
"queue",
"until",
"enough",
"time",
"has",
"passed",
... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/common/decorators.py#L49-L72 | [
"def",
"rate_limited",
"(",
"max_per_second",
")",
":",
"min_interval",
"=",
"1.0",
"/",
"float",
"(",
"max_per_second",
")",
"def",
"decorate",
"(",
"func",
")",
":",
"last_time_called",
"=",
"[",
"0.0",
"]",
"rate_lock",
"=",
"threading",
".",
"Lock",
"(... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | deprecated | This decorator marks methods as deprecated.
A warning is displayed if the method is called. | seleniumbase/common/decorators.py | def deprecated(message=None):
""" This decorator marks methods as deprecated.
A warning is displayed if the method is called. """
def decorated_method_to_deprecate(func):
if inspect.isclass(func):
# Handle a deprecated class differently from a deprecated method
msg = "Cl... | def deprecated(message=None):
""" This decorator marks methods as deprecated.
A warning is displayed if the method is called. """
def decorated_method_to_deprecate(func):
if inspect.isclass(func):
# Handle a deprecated class differently from a deprecated method
msg = "Cl... | [
"This",
"decorator",
"marks",
"methods",
"as",
"deprecated",
".",
"A",
"warning",
"is",
"displayed",
"if",
"the",
"method",
"is",
"called",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/common/decorators.py#L75-L100 | [
"def",
"deprecated",
"(",
"message",
"=",
"None",
")",
":",
"def",
"decorated_method_to_deprecate",
"(",
"func",
")",
":",
"if",
"inspect",
".",
"isclass",
"(",
"func",
")",
":",
"# Handle a deprecated class differently from a deprecated method",
"msg",
"=",
"\"Clas... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | EmailManager.imap_connect | Connect to the IMAP mailbox. | seleniumbase/fixtures/email_manager.py | def imap_connect(self):
"""
Connect to the IMAP mailbox.
"""
self.mailbox = imaplib.IMAP4_SSL(self.imap_string, self.port)
self.mailbox.login(self.uname, self.pwd)
self.mailbox.select() | def imap_connect(self):
"""
Connect to the IMAP mailbox.
"""
self.mailbox = imaplib.IMAP4_SSL(self.imap_string, self.port)
self.mailbox.login(self.uname, self.pwd)
self.mailbox.select() | [
"Connect",
"to",
"the",
"IMAP",
"mailbox",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/email_manager.py#L39-L45 | [
"def",
"imap_connect",
"(",
"self",
")",
":",
"self",
".",
"mailbox",
"=",
"imaplib",
".",
"IMAP4_SSL",
"(",
"self",
".",
"imap_string",
",",
"self",
".",
"port",
")",
"self",
".",
"mailbox",
".",
"login",
"(",
"self",
".",
"uname",
",",
"self",
".",... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | EmailManager.__imap_search | Searches for query in the given IMAP criteria and returns
the message numbers that match as a list of strings.
Criteria without values (eg DELETED) should be keyword args
with KEY=True, or else not passed. Criteria with values should
be keyword args of the form KEY="VALUE" where KEY is ... | seleniumbase/fixtures/email_manager.py | def __imap_search(self, ** criteria_dict):
""" Searches for query in the given IMAP criteria and returns
the message numbers that match as a list of strings.
Criteria without values (eg DELETED) should be keyword args
with KEY=True, or else not passed. Criteria with values should
... | def __imap_search(self, ** criteria_dict):
""" Searches for query in the given IMAP criteria and returns
the message numbers that match as a list of strings.
Criteria without values (eg DELETED) should be keyword args
with KEY=True, or else not passed. Criteria with values should
... | [
"Searches",
"for",
"query",
"in",
"the",
"given",
"IMAP",
"criteria",
"and",
"returns",
"the",
"message",
"numbers",
"that",
"match",
"as",
"a",
"list",
"of",
"strings",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/email_manager.py#L54-L102 | [
"def",
"__imap_search",
"(",
"self",
",",
"*",
"*",
"criteria_dict",
")",
":",
"self",
".",
"imap_connect",
"(",
")",
"criteria",
"=",
"[",
"]",
"for",
"key",
"in",
"criteria_dict",
":",
"if",
"criteria_dict",
"[",
"key",
"]",
"is",
"True",
":",
"crite... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | EmailManager.__parse_imap_search_result | This takes the result of imap_search and returns SANE results
@Params
result - result from an imap_search call
@Returns
List of IMAP search results | seleniumbase/fixtures/email_manager.py | def __parse_imap_search_result(self, result):
"""
This takes the result of imap_search and returns SANE results
@Params
result - result from an imap_search call
@Returns
List of IMAP search results
"""
if isinstance(result, types.ListType):
# A... | def __parse_imap_search_result(self, result):
"""
This takes the result of imap_search and returns SANE results
@Params
result - result from an imap_search call
@Returns
List of IMAP search results
"""
if isinstance(result, types.ListType):
# A... | [
"This",
"takes",
"the",
"result",
"of",
"imap_search",
"and",
"returns",
"SANE",
"results"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/email_manager.py#L114-L133 | [
"def",
"__parse_imap_search_result",
"(",
"self",
",",
"result",
")",
":",
"if",
"isinstance",
"(",
"result",
",",
"types",
".",
"ListType",
")",
":",
"# Above is same as \"type(result) == types.ListType\"",
"if",
"len",
"(",
"result",
")",
"==",
"1",
":",
"retu... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | EmailManager.fetch_html | Given a message number that we found with imap_search,
get the text/html content.
@Params
msg_nums - message number to get html message for
@Returns
HTML content of message matched by message number | seleniumbase/fixtures/email_manager.py | def fetch_html(self, msg_nums):
"""
Given a message number that we found with imap_search,
get the text/html content.
@Params
msg_nums - message number to get html message for
@Returns
HTML content of message matched by message number
"""
if not ms... | def fetch_html(self, msg_nums):
"""
Given a message number that we found with imap_search,
get the text/html content.
@Params
msg_nums - message number to get html message for
@Returns
HTML content of message matched by message number
"""
if not ms... | [
"Given",
"a",
"message",
"number",
"that",
"we",
"found",
"with",
"imap_search",
"get",
"the",
"text",
"/",
"html",
"content",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/email_manager.py#L135-L147 | [
"def",
"fetch_html",
"(",
"self",
",",
"msg_nums",
")",
":",
"if",
"not",
"msg_nums",
":",
"raise",
"Exception",
"(",
"\"Invalid Message Number!\"",
")",
"return",
"self",
".",
"__imap_fetch_content_type",
"(",
"msg_nums",
",",
"self",
".",
"HTML",
")"
] | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | EmailManager.fetch_plaintext | Given a message number that we found with imap_search,
get the text/plain content.
@Params
msg_nums - message number to get message for
@Returns
Plaintext content of message matched by message number | seleniumbase/fixtures/email_manager.py | def fetch_plaintext(self, msg_nums):
"""
Given a message number that we found with imap_search,
get the text/plain content.
@Params
msg_nums - message number to get message for
@Returns
Plaintext content of message matched by message number
"""
if ... | def fetch_plaintext(self, msg_nums):
"""
Given a message number that we found with imap_search,
get the text/plain content.
@Params
msg_nums - message number to get message for
@Returns
Plaintext content of message matched by message number
"""
if ... | [
"Given",
"a",
"message",
"number",
"that",
"we",
"found",
"with",
"imap_search",
"get",
"the",
"text",
"/",
"plain",
"content",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/email_manager.py#L149-L161 | [
"def",
"fetch_plaintext",
"(",
"self",
",",
"msg_nums",
")",
":",
"if",
"not",
"msg_nums",
":",
"raise",
"Exception",
"(",
"\"Invalid Message Number!\"",
")",
"return",
"self",
".",
"__imap_fetch_content_type",
"(",
"msg_nums",
",",
"self",
".",
"PLAIN",
")"
] | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | EmailManager.__imap_fetch_content_type | Given a message number that we found with imap_search, fetch the
whole source, dump that into an email object, and pick out the part
that matches the content type specified. Return that, if we got
multiple emails, return dict of all the parts.
@Params
msg_nums - message number to... | seleniumbase/fixtures/email_manager.py | def __imap_fetch_content_type(self, msg_nums, content_type):
"""
Given a message number that we found with imap_search, fetch the
whole source, dump that into an email object, and pick out the part
that matches the content type specified. Return that, if we got
multiple emails, r... | def __imap_fetch_content_type(self, msg_nums, content_type):
"""
Given a message number that we found with imap_search, fetch the
whole source, dump that into an email object, and pick out the part
that matches the content type specified. Return that, if we got
multiple emails, r... | [
"Given",
"a",
"message",
"number",
"that",
"we",
"found",
"with",
"imap_search",
"fetch",
"the",
"whole",
"source",
"dump",
"that",
"into",
"an",
"email",
"object",
"and",
"pick",
"out",
"the",
"part",
"that",
"matches",
"the",
"content",
"type",
"specified"... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/email_manager.py#L163-L194 | [
"def",
"__imap_fetch_content_type",
"(",
"self",
",",
"msg_nums",
",",
"content_type",
")",
":",
"if",
"not",
"msg_nums",
":",
"raise",
"Exception",
"(",
"\"Invalid Message Number!\"",
")",
"if",
"not",
"content_type",
":",
"raise",
"Exception",
"(",
"\"Need a con... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | EmailManager.fetch_html_by_subject | Get the html of an email, searching by subject.
@Params
email_name - the subject to search for
@Returns
HTML content of the matched email | seleniumbase/fixtures/email_manager.py | def fetch_html_by_subject(self, email_name):
"""
Get the html of an email, searching by subject.
@Params
email_name - the subject to search for
@Returns
HTML content of the matched email
"""
if not email_name:
raise EmailException("Subject cann... | def fetch_html_by_subject(self, email_name):
"""
Get the html of an email, searching by subject.
@Params
email_name - the subject to search for
@Returns
HTML content of the matched email
"""
if not email_name:
raise EmailException("Subject cann... | [
"Get",
"the",
"html",
"of",
"an",
"email",
"searching",
"by",
"subject",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/email_manager.py#L196-L210 | [
"def",
"fetch_html_by_subject",
"(",
"self",
",",
"email_name",
")",
":",
"if",
"not",
"email_name",
":",
"raise",
"EmailException",
"(",
"\"Subject cannot be null\"",
")",
"results",
"=",
"self",
".",
"__imap_search",
"(",
"SUBJECT",
"=",
"email_name",
")",
"so... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | EmailManager.fetch_plaintext_by_subject | Get the plain text of an email, searching by subject.
@Params
email_name - the subject to search for
@Returns
Plaintext content of the matched email | seleniumbase/fixtures/email_manager.py | def fetch_plaintext_by_subject(self, email_name):
"""
Get the plain text of an email, searching by subject.
@Params
email_name - the subject to search for
@Returns
Plaintext content of the matched email
"""
if not email_name:
raise EmailExcepti... | def fetch_plaintext_by_subject(self, email_name):
"""
Get the plain text of an email, searching by subject.
@Params
email_name - the subject to search for
@Returns
Plaintext content of the matched email
"""
if not email_name:
raise EmailExcepti... | [
"Get",
"the",
"plain",
"text",
"of",
"an",
"email",
"searching",
"by",
"subject",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/email_manager.py#L212-L226 | [
"def",
"fetch_plaintext_by_subject",
"(",
"self",
",",
"email_name",
")",
":",
"if",
"not",
"email_name",
":",
"raise",
"EmailException",
"(",
"\"Subject cannot be null\"",
")",
"results",
"=",
"self",
".",
"__imap_search",
"(",
"SUBJECT",
"=",
"email_name",
")",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | EmailManager.search_for_recipient | Get content of emails, sent to a specific email address.
@Params
email - the recipient email address to search for
timeout - seconds to try beore timing out
content_type - type of email string to return
@Returns
Content of the matched email in the given content type | seleniumbase/fixtures/email_manager.py | def search_for_recipient(self, email, timeout=None, content_type=None):
"""
Get content of emails, sent to a specific email address.
@Params
email - the recipient email address to search for
timeout - seconds to try beore timing out
content_type - type of email string to ... | def search_for_recipient(self, email, timeout=None, content_type=None):
"""
Get content of emails, sent to a specific email address.
@Params
email - the recipient email address to search for
timeout - seconds to try beore timing out
content_type - type of email string to ... | [
"Get",
"content",
"of",
"emails",
"sent",
"to",
"a",
"specific",
"email",
"address",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/email_manager.py#L228-L239 | [
"def",
"search_for_recipient",
"(",
"self",
",",
"email",
",",
"timeout",
"=",
"None",
",",
"content_type",
"=",
"None",
")",
":",
"return",
"self",
".",
"search",
"(",
"timeout",
"=",
"timeout",
",",
"content_type",
"=",
"content_type",
",",
"TO",
"=",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | EmailManager.search_for_subject | Get content of emails, sent to a specific email address.
@Params
email - the recipient email address to search for
timeout - seconds to try beore timing out
content_type - type of email string to return
@Returns
Content of the matched email in the given content type | seleniumbase/fixtures/email_manager.py | def search_for_subject(self, subject, timeout=None, content_type=None):
"""
Get content of emails, sent to a specific email address.
@Params
email - the recipient email address to search for
timeout - seconds to try beore timing out
content_type - type of email string to ... | def search_for_subject(self, subject, timeout=None, content_type=None):
"""
Get content of emails, sent to a specific email address.
@Params
email - the recipient email address to search for
timeout - seconds to try beore timing out
content_type - type of email string to ... | [
"Get",
"content",
"of",
"emails",
"sent",
"to",
"a",
"specific",
"email",
"address",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/email_manager.py#L241-L252 | [
"def",
"search_for_subject",
"(",
"self",
",",
"subject",
",",
"timeout",
"=",
"None",
",",
"content_type",
"=",
"None",
")",
":",
"return",
"self",
".",
"search",
"(",
"timeout",
"=",
"timeout",
",",
"content_type",
"=",
"content_type",
",",
"SUBJECT",
"=... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | EmailManager.search_for_count | A search that keeps searching up until timeout for a
specific number of matches to a search. If timeout is not
specified we use the default. If count= is not specified we
will fail. Return values are the same as search(), except for count=0,
where we will return an empty list. Use this ... | seleniumbase/fixtures/email_manager.py | def search_for_count(self, ** args):
"""
A search that keeps searching up until timeout for a
specific number of matches to a search. If timeout is not
specified we use the default. If count= is not specified we
will fail. Return values are the same as search(), except for count... | def search_for_count(self, ** args):
"""
A search that keeps searching up until timeout for a
specific number of matches to a search. If timeout is not
specified we use the default. If count= is not specified we
will fail. Return values are the same as search(), except for count... | [
"A",
"search",
"that",
"keeps",
"searching",
"up",
"until",
"timeout",
"for",
"a",
"specific",
"number",
"of",
"matches",
"to",
"a",
"search",
".",
"If",
"timeout",
"is",
"not",
"specified",
"we",
"use",
"the",
"default",
".",
"If",
"count",
"=",
"is",
... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/email_manager.py#L254-L299 | [
"def",
"search_for_count",
"(",
"self",
",",
"*",
"*",
"args",
")",
":",
"if",
"\"timeout\"",
"not",
"in",
"args",
".",
"keys",
"(",
")",
":",
"timeout",
"=",
"self",
".",
"TIMEOUT",
"elif",
"args",
"[",
"\"timeout\"",
"]",
":",
"timeout",
"=",
"args... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | EmailManager.__check_msg_for_headers | Checks an Email.Message object for the headers in email_headers.
Following are acceptable header names: ['Delivered-To',
'Received', 'Return-Path', 'Received-SPF',
'Authentication-Results', 'DKIM-Signature',
'DomainKey-Signature', 'From', 'To', 'Message-ID',
'Sub... | seleniumbase/fixtures/email_manager.py | def __check_msg_for_headers(self, msg, ** email_headers):
"""
Checks an Email.Message object for the headers in email_headers.
Following are acceptable header names: ['Delivered-To',
'Received', 'Return-Path', 'Received-SPF',
'Authentication-Results', 'DKIM-Signature',
... | def __check_msg_for_headers(self, msg, ** email_headers):
"""
Checks an Email.Message object for the headers in email_headers.
Following are acceptable header names: ['Delivered-To',
'Received', 'Return-Path', 'Received-SPF',
'Authentication-Results', 'DKIM-Signature',
... | [
"Checks",
"an",
"Email",
".",
"Message",
"object",
"for",
"the",
"headers",
"in",
"email_headers",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/email_manager.py#L301-L323 | [
"def",
"__check_msg_for_headers",
"(",
"self",
",",
"msg",
",",
"*",
"*",
"email_headers",
")",
":",
"all_headers_found",
"=",
"False",
"email_headers",
"[",
"'Delivered-To'",
"]",
"=",
"email_headers",
"[",
"'To'",
"]",
"email_headers",
".",
"pop",
"(",
"'To'... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | EmailManager.fetch_message | Given a message number, return the Email.Message object.
@Params
msgnum - message number to find
@Returns
Email.Message object for the given message number | seleniumbase/fixtures/email_manager.py | def fetch_message(self, msgnum):
"""
Given a message number, return the Email.Message object.
@Params
msgnum - message number to find
@Returns
Email.Message object for the given message number
"""
self.imap_connect()
status, data = self.mailbox.fet... | def fetch_message(self, msgnum):
"""
Given a message number, return the Email.Message object.
@Params
msgnum - message number to find
@Returns
Email.Message object for the given message number
"""
self.imap_connect()
status, data = self.mailbox.fet... | [
"Given",
"a",
"message",
"number",
"return",
"the",
"Email",
".",
"Message",
"object",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/email_manager.py#L325-L339 | [
"def",
"fetch_message",
"(",
"self",
",",
"msgnum",
")",
":",
"self",
".",
"imap_connect",
"(",
")",
"status",
",",
"data",
"=",
"self",
".",
"mailbox",
".",
"fetch",
"(",
"msgnum",
",",
"\"(RFC822)\"",
")",
"self",
".",
"imap_disconnect",
"(",
")",
"f... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | EmailManager.get_content_type | Given an Email.Message object, gets the content-type payload
as specified by @content_type. This is the actual body of the
email.
@Params
msg - Email.Message object to get message content for
content_type - Type of content to get from the email
@Return
String cont... | seleniumbase/fixtures/email_manager.py | def get_content_type(self, msg, content_type="HTML"):
"""
Given an Email.Message object, gets the content-type payload
as specified by @content_type. This is the actual body of the
email.
@Params
msg - Email.Message object to get message content for
content_type -... | def get_content_type(self, msg, content_type="HTML"):
"""
Given an Email.Message object, gets the content-type payload
as specified by @content_type. This is the actual body of the
email.
@Params
msg - Email.Message object to get message content for
content_type -... | [
"Given",
"an",
"Email",
".",
"Message",
"object",
"gets",
"the",
"content",
"-",
"type",
"payload",
"as",
"specified",
"by"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/email_manager.py#L341-L359 | [
"def",
"get_content_type",
"(",
"self",
",",
"msg",
",",
"content_type",
"=",
"\"HTML\"",
")",
":",
"if",
"\"HTML\"",
"in",
"content_type",
".",
"upper",
"(",
")",
":",
"content_type",
"=",
"self",
".",
"HTML",
"elif",
"\"PLAIN\"",
"in",
"content_type",
".... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | EmailManager.search | Checks email inbox every 15 seconds that match the criteria
up until timeout.
Search criteria should be keyword args eg
TO="selenium@gmail.com". See __imap_search docstring for list
of valid criteria. If content_type is not defined, will return
a list of msg numbers.
O... | seleniumbase/fixtures/email_manager.py | def search(self, ** args):
"""
Checks email inbox every 15 seconds that match the criteria
up until timeout.
Search criteria should be keyword args eg
TO="selenium@gmail.com". See __imap_search docstring for list
of valid criteria. If content_type is not defined, will r... | def search(self, ** args):
"""
Checks email inbox every 15 seconds that match the criteria
up until timeout.
Search criteria should be keyword args eg
TO="selenium@gmail.com". See __imap_search docstring for list
of valid criteria. If content_type is not defined, will r... | [
"Checks",
"email",
"inbox",
"every",
"15",
"seconds",
"that",
"match",
"the",
"criteria",
"up",
"until",
"timeout",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/email_manager.py#L361-L428 | [
"def",
"search",
"(",
"self",
",",
"*",
"*",
"args",
")",
":",
"if",
"\"content_type\"",
"not",
"in",
"args",
".",
"keys",
"(",
")",
":",
"content_type",
"=",
"None",
"elif",
"\"HTML\"",
"in",
"args",
"[",
"\"content_type\"",
"]",
":",
"content_type",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | EmailManager.remove_whitespace | Clean whitespace from html
@Params
html - html source to remove whitespace from
@Returns
String html without whitespace | seleniumbase/fixtures/email_manager.py | def remove_whitespace(self, html):
"""
Clean whitespace from html
@Params
html - html source to remove whitespace from
@Returns
String html without whitespace
"""
# Does python have a better way to do exactly this?
clean_html = html
for cha... | def remove_whitespace(self, html):
"""
Clean whitespace from html
@Params
html - html source to remove whitespace from
@Returns
String html without whitespace
"""
# Does python have a better way to do exactly this?
clean_html = html
for cha... | [
"Clean",
"whitespace",
"from",
"html"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/email_manager.py#L430-L442 | [
"def",
"remove_whitespace",
"(",
"self",
",",
"html",
")",
":",
"# Does python have a better way to do exactly this?",
"clean_html",
"=",
"html",
"for",
"char",
"in",
"(",
"\"\\r\"",
",",
"\"\\n\"",
",",
"\"\\t\"",
")",
":",
"clean_html",
"=",
"clean_html",
".",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | EmailManager.replace_entities | Replace htmlentities with unicode characters
@Params
html - html source to replace entities in
@Returns
String html with entities replaced | seleniumbase/fixtures/email_manager.py | def replace_entities(self, html):
"""
Replace htmlentities with unicode characters
@Params
html - html source to replace entities in
@Returns
String html with entities replaced
"""
def fixup(text):
"""replace the htmlentities in some text"""
... | def replace_entities(self, html):
"""
Replace htmlentities with unicode characters
@Params
html - html source to replace entities in
@Returns
String html with entities replaced
"""
def fixup(text):
"""replace the htmlentities in some text"""
... | [
"Replace",
"htmlentities",
"with",
"unicode",
"characters"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/email_manager.py#L454-L481 | [
"def",
"replace_entities",
"(",
"self",
",",
"html",
")",
":",
"def",
"fixup",
"(",
"text",
")",
":",
"\"\"\"replace the htmlentities in some text\"\"\"",
"text",
"=",
"text",
".",
"group",
"(",
"0",
")",
"if",
"text",
"[",
":",
"2",
"]",
"==",
"\"&#\"",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | wait_for_ready_state_complete | The DOM (Document Object Model) has a property called "readyState".
When the value of this becomes "complete", page resources are considered
fully loaded (although AJAX and other loads might still be happening).
This method will wait until document.readyState == "complete". | seleniumbase/fixtures/js_utils.py | def wait_for_ready_state_complete(driver, timeout=settings.EXTREME_TIMEOUT):
"""
The DOM (Document Object Model) has a property called "readyState".
When the value of this becomes "complete", page resources are considered
fully loaded (although AJAX and other loads might still be happening).
This me... | def wait_for_ready_state_complete(driver, timeout=settings.EXTREME_TIMEOUT):
"""
The DOM (Document Object Model) has a property called "readyState".
When the value of this becomes "complete", page resources are considered
fully loaded (although AJAX and other loads might still be happening).
This me... | [
"The",
"DOM",
"(",
"Document",
"Object",
"Model",
")",
"has",
"a",
"property",
"called",
"readyState",
".",
"When",
"the",
"value",
"of",
"this",
"becomes",
"complete",
"page",
"resources",
"are",
"considered",
"fully",
"loaded",
"(",
"although",
"AJAX",
"an... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/js_utils.py#L14-L40 | [
"def",
"wait_for_ready_state_complete",
"(",
"driver",
",",
"timeout",
"=",
"settings",
".",
"EXTREME_TIMEOUT",
")",
":",
"start_ms",
"=",
"time",
".",
"time",
"(",
")",
"*",
"1000.0",
"stop_ms",
"=",
"start_ms",
"+",
"(",
"timeout",
"*",
"1000.0",
")",
"f... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | activate_jquery | If "jQuery is not defined", use this method to activate it for use.
This happens because jQuery is not always defined on web sites. | seleniumbase/fixtures/js_utils.py | def activate_jquery(driver):
""" If "jQuery is not defined", use this method to activate it for use.
This happens because jQuery is not always defined on web sites. """
try:
# Let's first find out if jQuery is already defined.
driver.execute_script("jQuery('html')")
# Since that ... | def activate_jquery(driver):
""" If "jQuery is not defined", use this method to activate it for use.
This happens because jQuery is not always defined on web sites. """
try:
# Let's first find out if jQuery is already defined.
driver.execute_script("jQuery('html')")
# Since that ... | [
"If",
"jQuery",
"is",
"not",
"defined",
"use",
"this",
"method",
"to",
"activate",
"it",
"for",
"use",
".",
"This",
"happens",
"because",
"jQuery",
"is",
"not",
"always",
"defined",
"on",
"web",
"sites",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/js_utils.py#L101-L130 | [
"def",
"activate_jquery",
"(",
"driver",
")",
":",
"try",
":",
"# Let's first find out if jQuery is already defined.",
"driver",
".",
"execute_script",
"(",
"\"jQuery('html')\"",
")",
"# Since that command worked, jQuery is defined. Let's return.",
"return",
"except",
"Exception"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | escape_quotes_if_needed | re.escape() works differently in Python 3.7.0 than earlier versions:
Python 3.6.5:
>>> import re
>>> re.escape('"')
'\\"'
Python 3.7.0:
>>> import re
>>> re.escape('"')
'"'
SeleniumBase needs quotes to be properly escaped for Javascript calls. | seleniumbase/fixtures/js_utils.py | def escape_quotes_if_needed(string):
"""
re.escape() works differently in Python 3.7.0 than earlier versions:
Python 3.6.5:
>>> import re
>>> re.escape('"')
'\\"'
Python 3.7.0:
>>> import re
>>> re.escape('"')
'"'
SeleniumBase needs quotes to be properly escaped for Javasc... | def escape_quotes_if_needed(string):
"""
re.escape() works differently in Python 3.7.0 than earlier versions:
Python 3.6.5:
>>> import re
>>> re.escape('"')
'\\"'
Python 3.7.0:
>>> import re
>>> re.escape('"')
'"'
SeleniumBase needs quotes to be properly escaped for Javasc... | [
"re",
".",
"escape",
"()",
"works",
"differently",
"in",
"Python",
"3",
".",
"7",
".",
"0",
"than",
"earlier",
"versions",
":"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/js_utils.py#L140-L161 | [
"def",
"escape_quotes_if_needed",
"(",
"string",
")",
":",
"if",
"are_quotes_escaped",
"(",
"string",
")",
":",
"if",
"string",
".",
"count",
"(",
"\"'\"",
")",
"!=",
"string",
".",
"count",
"(",
"\"\\\\'\"",
")",
":",
"string",
"=",
"string",
".",
"repl... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | safe_execute_script | When executing a script that contains a jQuery command,
it's important that the jQuery library has been loaded first.
This method will load jQuery if it wasn't already loaded. | seleniumbase/fixtures/js_utils.py | def safe_execute_script(driver, script):
""" When executing a script that contains a jQuery command,
it's important that the jQuery library has been loaded first.
This method will load jQuery if it wasn't already loaded. """
try:
driver.execute_script(script)
except Exception:
... | def safe_execute_script(driver, script):
""" When executing a script that contains a jQuery command,
it's important that the jQuery library has been loaded first.
This method will load jQuery if it wasn't already loaded. """
try:
driver.execute_script(script)
except Exception:
... | [
"When",
"executing",
"a",
"script",
"that",
"contains",
"a",
"jQuery",
"command",
"it",
"s",
"important",
"that",
"the",
"jQuery",
"library",
"has",
"been",
"loaded",
"first",
".",
"This",
"method",
"will",
"load",
"jQuery",
"if",
"it",
"wasn",
"t",
"alrea... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/js_utils.py#L164-L173 | [
"def",
"safe_execute_script",
"(",
"driver",
",",
"script",
")",
":",
"try",
":",
"driver",
".",
"execute_script",
"(",
"script",
")",
"except",
"Exception",
":",
"# The likely reason this fails is because: \"jQuery is not defined\"",
"activate_jquery",
"(",
"driver",
"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | post_message | A helper method to post a message on the screen with Messenger.
(Should only be called from post_message() in base_case.py) | seleniumbase/fixtures/js_utils.py | def post_message(driver, message, msg_dur, style="info"):
""" A helper method to post a message on the screen with Messenger.
(Should only be called from post_message() in base_case.py) """
if not msg_dur:
msg_dur = settings.DEFAULT_MESSAGE_DURATION
msg_dur = float(msg_dur)
message = re.... | def post_message(driver, message, msg_dur, style="info"):
""" A helper method to post a message on the screen with Messenger.
(Should only be called from post_message() in base_case.py) """
if not msg_dur:
msg_dur = settings.DEFAULT_MESSAGE_DURATION
msg_dur = float(msg_dur)
message = re.... | [
"A",
"helper",
"method",
"to",
"post",
"a",
"message",
"on",
"the",
"screen",
"with",
"Messenger",
".",
"(",
"Should",
"only",
"be",
"called",
"from",
"post_message",
"()",
"in",
"base_case",
".",
"py",
")"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/js_utils.py#L475-L499 | [
"def",
"post_message",
"(",
"driver",
",",
"message",
",",
"msg_dur",
",",
"style",
"=",
"\"info\"",
")",
":",
"if",
"not",
"msg_dur",
":",
"msg_dur",
"=",
"settings",
".",
"DEFAULT_MESSAGE_DURATION",
"msg_dur",
"=",
"float",
"(",
"msg_dur",
")",
"message",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | _jq_format | DEPRECATED - Use re.escape() instead, which performs the intended action.
Use before throwing raw code such as 'div[tab="advanced"]' into jQuery.
Selectors with quotes inside of quotes would otherwise break jQuery.
If you just want to escape quotes, there's escape_quotes_if_needed().
This is similar to ... | seleniumbase/fixtures/js_utils.py | def _jq_format(code):
"""
DEPRECATED - Use re.escape() instead, which performs the intended action.
Use before throwing raw code such as 'div[tab="advanced"]' into jQuery.
Selectors with quotes inside of quotes would otherwise break jQuery.
If you just want to escape quotes, there's escape_quotes_if... | def _jq_format(code):
"""
DEPRECATED - Use re.escape() instead, which performs the intended action.
Use before throwing raw code such as 'div[tab="advanced"]' into jQuery.
Selectors with quotes inside of quotes would otherwise break jQuery.
If you just want to escape quotes, there's escape_quotes_if... | [
"DEPRECATED",
"-",
"Use",
"re",
".",
"escape",
"()",
"instead",
"which",
"performs",
"the",
"intended",
"action",
".",
"Use",
"before",
"throwing",
"raw",
"code",
"such",
"as",
"div",
"[",
"tab",
"=",
"advanced",
"]",
"into",
"jQuery",
".",
"Selectors",
... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/js_utils.py#L634-L646 | [
"def",
"_jq_format",
"(",
"code",
")",
":",
"code",
"=",
"code",
".",
"replace",
"(",
"'\\\\'",
",",
"'\\\\\\\\'",
")",
".",
"replace",
"(",
"'\\t'",
",",
"'\\\\t'",
")",
".",
"replace",
"(",
"'\\n'",
",",
"'\\\\n'",
")",
"code",
"=",
"code",
".",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | Base.__log_all_options_if_none_specified | When testing_base is specified, but none of the log options to save are
specified (basic_test_info, screen_shots, page_source), then save them
all by default. Otherwise, save only selected ones from their plugins. | seleniumbase/plugins/base_plugin.py | def __log_all_options_if_none_specified(self, test):
"""
When testing_base is specified, but none of the log options to save are
specified (basic_test_info, screen_shots, page_source), then save them
all by default. Otherwise, save only selected ones from their plugins.
"""
... | def __log_all_options_if_none_specified(self, test):
"""
When testing_base is specified, but none of the log options to save are
specified (basic_test_info, screen_shots, page_source), then save them
all by default. Otherwise, save only selected ones from their plugins.
"""
... | [
"When",
"testing_base",
"is",
"specified",
"but",
"none",
"of",
"the",
"log",
"options",
"to",
"save",
"are",
"specified",
"(",
"basic_test_info",
"screen_shots",
"page_source",
")",
"then",
"save",
"them",
"all",
"by",
"default",
".",
"Otherwise",
"save",
"on... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/plugins/base_plugin.py#L124-L137 | [
"def",
"__log_all_options_if_none_specified",
"(",
"self",
",",
"test",
")",
":",
"if",
"(",
"(",
"not",
"self",
".",
"options",
".",
"enable_plugin_basic_test_info",
")",
"and",
"(",
"not",
"self",
".",
"options",
".",
"enable_plugin_screen_shots",
")",
"and",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | Base.addError | Since Skip, Blocked, and Deprecated are all technically errors, but not
error states, we want to make sure that they don't show up in
the nose output as errors. | seleniumbase/plugins/base_plugin.py | def addError(self, test, err, capt=None):
"""
Since Skip, Blocked, and Deprecated are all technically errors, but not
error states, we want to make sure that they don't show up in
the nose output as errors.
"""
if (err[0] == errors.BlockedTest or (
err[0] ... | def addError(self, test, err, capt=None):
"""
Since Skip, Blocked, and Deprecated are all technically errors, but not
error states, we want to make sure that they don't show up in
the nose output as errors.
"""
if (err[0] == errors.BlockedTest or (
err[0] ... | [
"Since",
"Skip",
"Blocked",
"and",
"Deprecated",
"are",
"all",
"technically",
"errors",
"but",
"not",
"error",
"states",
"we",
"want",
"to",
"make",
"sure",
"that",
"they",
"don",
"t",
"show",
"up",
"in",
"the",
"nose",
"output",
"as",
"errors",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/plugins/base_plugin.py#L167-L182 | [
"def",
"addError",
"(",
"self",
",",
"test",
",",
"err",
",",
"capt",
"=",
"None",
")",
":",
"if",
"(",
"err",
"[",
"0",
"]",
"==",
"errors",
".",
"BlockedTest",
"or",
"(",
"err",
"[",
"0",
"]",
"==",
"errors",
".",
"SkipTest",
")",
"or",
"(",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | Base.handleError | If the database plugin is not present, we have to handle capturing
"errors" that shouldn't be reported as such in base. | seleniumbase/plugins/base_plugin.py | def handleError(self, test, err, capt=None):
"""
If the database plugin is not present, we have to handle capturing
"errors" that shouldn't be reported as such in base.
"""
if not hasattr(test.test, "testcase_guid"):
if err[0] == errors.BlockedTest:
ra... | def handleError(self, test, err, capt=None):
"""
If the database plugin is not present, we have to handle capturing
"errors" that shouldn't be reported as such in base.
"""
if not hasattr(test.test, "testcase_guid"):
if err[0] == errors.BlockedTest:
ra... | [
"If",
"the",
"database",
"plugin",
"is",
"not",
"present",
"we",
"have",
"to",
"handle",
"capturing",
"errors",
"that",
"shouldn",
"t",
"be",
"reported",
"as",
"such",
"in",
"base",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/plugins/base_plugin.py#L184-L200 | [
"def",
"handleError",
"(",
"self",
",",
"test",
",",
"err",
",",
"capt",
"=",
"None",
")",
":",
"if",
"not",
"hasattr",
"(",
"test",
".",
"test",
",",
"\"testcase_guid\"",
")",
":",
"if",
"err",
"[",
"0",
"]",
"==",
"errors",
".",
"BlockedTest",
":... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | DatabaseManager.query_fetch_all | Executes a db query, gets all the values, and closes the connection. | seleniumbase/core/mysql.py | def query_fetch_all(self, query, values):
"""
Executes a db query, gets all the values, and closes the connection.
"""
self.cursor.execute(query, values)
retval = self.cursor.fetchall()
self.__close_db()
return retval | def query_fetch_all(self, query, values):
"""
Executes a db query, gets all the values, and closes the connection.
"""
self.cursor.execute(query, values)
retval = self.cursor.fetchall()
self.__close_db()
return retval | [
"Executes",
"a",
"db",
"query",
"gets",
"all",
"the",
"values",
"and",
"closes",
"the",
"connection",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/mysql.py#L39-L46 | [
"def",
"query_fetch_all",
"(",
"self",
",",
"query",
",",
"values",
")",
":",
"self",
".",
"cursor",
".",
"execute",
"(",
"query",
",",
"values",
")",
"retval",
"=",
"self",
".",
"cursor",
".",
"fetchall",
"(",
")",
"self",
".",
"__close_db",
"(",
")... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | DatabaseManager.query_fetch_one | Executes a db query, gets the first value, and closes the connection. | seleniumbase/core/mysql.py | def query_fetch_one(self, query, values):
"""
Executes a db query, gets the first value, and closes the connection.
"""
self.cursor.execute(query, values)
retval = self.cursor.fetchone()
self.__close_db()
return retval | def query_fetch_one(self, query, values):
"""
Executes a db query, gets the first value, and closes the connection.
"""
self.cursor.execute(query, values)
retval = self.cursor.fetchone()
self.__close_db()
return retval | [
"Executes",
"a",
"db",
"query",
"gets",
"the",
"first",
"value",
"and",
"closes",
"the",
"connection",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/mysql.py#L48-L55 | [
"def",
"query_fetch_one",
"(",
"self",
",",
"query",
",",
"values",
")",
":",
"self",
".",
"cursor",
".",
"execute",
"(",
"query",
",",
"values",
")",
"retval",
"=",
"self",
".",
"cursor",
".",
"fetchone",
"(",
")",
"self",
".",
"__close_db",
"(",
")... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | DatabaseManager.execute_query | Executes a query to the test_db and closes the connection afterwards. | seleniumbase/core/mysql.py | def execute_query(self, query, values):
"""
Executes a query to the test_db and closes the connection afterwards.
"""
retval = self.cursor.execute(query, values)
self.__close_db()
return retval | def execute_query(self, query, values):
"""
Executes a query to the test_db and closes the connection afterwards.
"""
retval = self.cursor.execute(query, values)
self.__close_db()
return retval | [
"Executes",
"a",
"query",
"to",
"the",
"test_db",
"and",
"closes",
"the",
"connection",
"afterwards",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/mysql.py#L57-L63 | [
"def",
"execute_query",
"(",
"self",
",",
"query",
",",
"values",
")",
":",
"retval",
"=",
"self",
".",
"cursor",
".",
"execute",
"(",
"query",
",",
"values",
")",
"self",
".",
"__close_db",
"(",
")",
"return",
"retval"
] | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | get_html_source_with_base_href | Combines the domain base href with the html source.
This is needed for the page html to render correctly. | seleniumbase/core/log_helper.py | def get_html_source_with_base_href(driver, page_source):
''' Combines the domain base href with the html source.
This is needed for the page html to render correctly. '''
last_page = get_last_page(driver)
if '://' in last_page:
base_href_html = get_base_href_html(last_page)
return '%... | def get_html_source_with_base_href(driver, page_source):
''' Combines the domain base href with the html source.
This is needed for the page html to render correctly. '''
last_page = get_last_page(driver)
if '://' in last_page:
base_href_html = get_base_href_html(last_page)
return '%... | [
"Combines",
"the",
"domain",
"base",
"href",
"with",
"the",
"html",
"source",
".",
"This",
"is",
"needed",
"for",
"the",
"page",
"html",
"to",
"render",
"correctly",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/log_helper.py#L97-L104 | [
"def",
"get_html_source_with_base_href",
"(",
"driver",
",",
"page_source",
")",
":",
"last_page",
"=",
"get_last_page",
"(",
"driver",
")",
"if",
"'://'",
"in",
"last_page",
":",
"base_href_html",
"=",
"get_base_href_html",
"(",
"last_page",
")",
"return",
"'%s\\... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | log_folder_setup | Handle Logging | seleniumbase/core/log_helper.py | def log_folder_setup(log_path, archive_logs=False):
""" Handle Logging """
if log_path.endswith("/"):
log_path = log_path[:-1]
if not os.path.exists(log_path):
try:
os.makedirs(log_path)
except Exception:
pass # Should only be reachable during multi-threaded ... | def log_folder_setup(log_path, archive_logs=False):
""" Handle Logging """
if log_path.endswith("/"):
log_path = log_path[:-1]
if not os.path.exists(log_path):
try:
os.makedirs(log_path)
except Exception:
pass # Should only be reachable during multi-threaded ... | [
"Handle",
"Logging"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/log_helper.py#L107-L132 | [
"def",
"log_folder_setup",
"(",
"log_path",
",",
"archive_logs",
"=",
"False",
")",
":",
"if",
"log_path",
".",
"endswith",
"(",
"\"/\"",
")",
":",
"log_path",
"=",
"log_path",
"[",
":",
"-",
"1",
"]",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.