Package tlib :: Package base :: Module WebDriverTester :: Class WebDriverTester
[hide private]
[frames] | no frames]

Class WebDriverTester

source code

               object --+    
                        |    
PytestTester.PytestTester --+
                            |
                           WebDriverTester
Known Subclasses:

Instance Methods [hide private]
 
_find_screenshot_folder(self)
Will try to find a folder named "screenshot" starting from the file being executed and up to three levels up
source code
 
_get_unused_report_name(self, tc_id, tc_params)
Gets a string based on test case id and name, taking into account if test case has already been run or not
source code
 
get_webelement_by_css(self, locator_string)
Get the webelement by CSS
source code
 
get_webelement_by_link_text(self, locator_string)
Get the webelement by link text
source code
 
get_webelement_by_xpath(self, locator_string)
Get the webelement by xpath
source code
 
get_webelements_by_css(self, locator_string)
Get the webelement list by CSS
source code
 
get_webelements_by_xpath(self, locator_string)
Get the webelement list by xpath
source code
 
initialize_webdriver_class(self, request) source code
 
save_screenshot(self, description)
Saves screen shot for the current page
source code
 
screenshot_folder(self)
Returns location of screenshot folder
source code
 
setup_webdriver_test(self, request)
Goes to homepage before each test, unless marker skipsetup is given
source code
bool
wait_for_alert(self, timeout=10)
Waist until an alert is visible
source code
WebElement
wait_for_element_to_be_clickable(self, locator_strategy, locator_string, error_msg=None, timeout=10)
Wait until an element cna be clicked
source code
WebElement
wait_for_element_to_be_invisible(self, locator_strategy, locator_string, error_msg=None, timeout=10)
Wait until an element becomes invisible
source code
WebElement
wait_for_element_to_be_present(self, locator_strategy, locator_string, error_msg=None, timeout=10)
Wait until an element is present
source code
WebElement
wait_for_element_to_be_selected(self, locator_strategy, locator_string, error_msg=None, timeout=10)
Wait until an element is selected
source code
WebElement
wait_for_element_to_be_static(self, locator_strategy, locator_string, error_msg=None, timeout=10)
Wait until an element that moves on the screen stops moving
source code
WebElement
wait_for_element_to_be_visible(self, locator_strategy, locator_string, error_msg=None, timeout=10)
Wait until an element becomes visible
source code
 
wait_for_page_loaded(self, timeout=10) source code
 
wait_for_text_to_be_present_in_element(self, locator_strategy, locator_string, text, error_msg=None, timeout=10)
Wait for an element that contains specified text
source code
 
wait_for_text_to_be_present_in_element_value(self, locator_strategy, locator_string, text, error_msg=None, timeout=10)
Wait for an element's value to contain some test
source code

Inherited from PytestTester.PytestTester: ignore_windows_GPF_dialog, initialize_PytestTester_class, log

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __metaclass__ = Singleton
  _driver = None
  _folder_dest = None
  _jinja_env = jinja2.Environment(loader= jinja2.FileSystemLoade...
  _request = None
  _screenshot_report = None
  _screenshot_report_template = <Template 'screenshot_report.html'>
  _screenshots = {}
  _tc_screenshot_template = <Template 'testcase_screenshots.html'>
  _test_case_id = None
  _test_case_name = None
  _test_params = None

Inherited from PytestTester.PytestTester: test_logger, tlib_logger

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

_find_screenshot_folder(self)

source code 

Will try to find a folder named "screenshot" starting from the file being executed and up to three levels up

Returns:
str

_get_unused_report_name(self, tc_id, tc_params)

source code 

Gets a string based on test case id and name, taking into account if test case has already been run or not

Parameters:
  • tc_id (str) - Test case id
  • tc_name (str)

get_webelement_by_css(self, locator_string)

source code 

Get the webelement by CSS

Parameters:
  • locator_string (str) - String used to locate element
  • error_msg (str) - Error string to show if element is not found

get_webelement_by_link_text(self, locator_string)

source code 

Get the webelement by link text

Parameters:
  • locator_string (str) - String used to locate element
  • error_msg (str) - Error string to show if element is not found

get_webelement_by_xpath(self, locator_string)

source code 

Get the webelement by xpath

Parameters:
  • locator_string (str) - String used to locate element
  • error_msg (str) - Error string to show if element is not found

get_webelements_by_css(self, locator_string)

source code 

Get the webelement list by CSS

Parameters:
  • locator_string (str) - String used to locate element
  • error_msg (str) - Error string to show if element is not found

get_webelements_by_xpath(self, locator_string)

source code 

Get the webelement list by xpath

Parameters:
  • locator_string (str) - String used to locate element
  • error_msg (str) - Error string to show if element is not found

initialize_webdriver_class(self, request)

source code 
Parameters:
  • request (FixtureRequest)
Decorators:
  • @pytest.fixture(scope= 'class', autouse= True)

screenshot_folder(self)

source code 

Returns location of screenshot folder

Returns:
str

setup_webdriver_test(self, request)

source code 

Goes to homepage before each test, unless marker skipsetup is given

Parameters:
  • request (FixtureRequest)
Decorators:
  • @pytest.fixture(scope= 'function', autouse= True)

wait_for_alert(self, timeout=10)

source code 

Waist until an alert is visible

Parameters:
  • timeout (Integer) - Number of seconds before timing out
Returns: bool

wait_for_element_to_be_clickable(self, locator_strategy, locator_string, error_msg=None, timeout=10)

source code 

Wait until an element cna be clicked

Parameters:
  • locator_strategy (By) - Location strategy to use
  • locator_string (str) - String used to locate element
  • error_msg (str) - Error string to show if element is not found
  • timeout (int) - Maximum time in seconds to wait for the element to be clickable
Returns: WebElement

wait_for_element_to_be_invisible(self, locator_strategy, locator_string, error_msg=None, timeout=10)

source code 

Wait until an element becomes invisible

Parameters:
  • locator_strategy (By) - Location strategy to use
  • locator_string (str) - String used to locate element
  • error_msg (str) - Error string to show if element is not found
  • timeout (int) - Maximum time in seconds to wait for the element to be hidden
Returns: WebElement

wait_for_element_to_be_present(self, locator_strategy, locator_string, error_msg=None, timeout=10)

source code 

Wait until an element is present

Parameters:
  • locator_strategy (By) - Location strategy to use
  • locator_string (str) - String used to locate element
  • error_msg (str) - Error string to show if element is not found
  • timeout (int) - Maximum time in seconds to wait for the element to be present
Returns: WebElement

wait_for_element_to_be_selected(self, locator_strategy, locator_string, error_msg=None, timeout=10)

source code 

Wait until an element is selected

Parameters:
  • locator_strategy (By) - Location strategy to use
  • locator_string (str) - String used to locate element
  • error_msg (str) - Error string to show if element is not found
  • timeout (int) - Maximum time in seconds to wait for the element to be selected
Returns: WebElement

wait_for_element_to_be_static(self, locator_strategy, locator_string, error_msg=None, timeout=10)

source code 

Wait until an element that moves on the screen stops moving

Parameters:
  • locator_strategy (By) - Location strategy to use
  • locator_string (str) - String used to locate element
  • error_msg (str) - Error string to show if element is not found
  • timeout (int) - Maximum time in seconds to wait for the element to be visible
Returns: WebElement

wait_for_element_to_be_visible(self, locator_strategy, locator_string, error_msg=None, timeout=10)

source code 

Wait until an element becomes visible

Parameters:
  • locator_strategy (By) - Location strategy to use
  • locator_string (str) - String used to locate element
  • error_msg (str) - Error string to show if element is not found
  • timeout (int) - Maximum time in seconds to wait for the element to be visible
Returns: WebElement

wait_for_text_to_be_present_in_element(self, locator_strategy, locator_string, text, error_msg=None, timeout=10)

source code 

Wait for an element that contains specified text

Parameters:
  • locator_strategy (By) - Location strategy to use
  • locator_string (str) - String used to locate element
  • error_msg (str) - Error string to show if element is not found
  • timeout (int) - Maximum time in seconds to wait

wait_for_text_to_be_present_in_element_value(self, locator_strategy, locator_string, text, error_msg=None, timeout=10)

source code 

Wait for an element's value to contain some test

Parameters:
  • locator_strategy (By) - Location strategy to use
  • locator_string (str) - String used to locate element
  • error_msg (str) - Error string to show if element is not found
  • timeout (int) - Maximum time in seconds to wait

Class Variable Details [hide private]

_jinja_env

Value:
jinja2.Environment(loader= jinja2.FileSystemLoader(TestHelper.tlib_tem\
plate_folder()), trim_blocks= True)