Selenium Flashcards

1
Q

what are the values for document.readyState

A
  1. loading - still loading
  2. interactive - document has finished loading and the document has been parsed but sub-resources such as scripts, images, stylesheets and frames are still loading. The state indicates that the DOMContentLoaded event is about to fire.
  3. complete - The document and all sub-resources have finished loading. The state indicates that the load event is about to fire.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what are the 3 page load strategies
options = Options()
options.page_load_strategy = …

A
  1. ‘normal’ (default) - waits for DOM and all resources to load (document.readyState = ‘complete’)
  2. ‘eager’ - DOM access is ready, but other resources like images may still be loading
    (document.readyState = ‘loading’)
  3. none - Does not block WebDriver at all
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is implicit wait

A

driver.implicitly_wait(10)
1. tell WebDriver to poll the DOM for a certain amount of time when trying to find an element or elements if they are not immediately available.
2. default is 0 (disabled)
3. set for the life of the session
4. shouldn’t me mixed with explicit wait

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is fluent wait.

A

wait = WebDriverWait(driver, timeout=10, poll_frequency=1, ignored_exceptions=[ElementNotVisibleException, ElementNotSelectableException])

element =wait.until(
EC.element_to_be_clickable((By.XPATH, “//div”)))
1. defines the maximum amount of time to wait for a condition
2. defines frequency with which to check the condition.
3. allows ignoring of specific types of exceptions whilst waiting, such as NoSuchElementException

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what is explicit wait

A

halts program execution until the condition you pass it resolves. The condition is called with a certain frequency until the timeout of the wait is elapsed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what are some of the expected conditions for waits

A

alert is present
element exists
element is visible
title contains
title is
element staleness
visible text

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is default polling frequency in explicit wait

A

0.5 sec

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what are the 2 types of assertions

A
  1. hard assertions - exec
  2. soft assertions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly