def __init__(self, webdriver, *args, **kwargs):
        """Constructor.  It's better to not call this directly, instead use PageFactory 
        to instantiate PageObjects.

        Args: 
            webdriver (Webdriver): Selenium Webdriver instance.

        """
        try:
            config_reader = kwargs['config_reader']
        except KeyError:
            config_reader = WTF_CONFIG_READER

        try:
            self._validate_page(webdriver)
        except TypeError as e:
            _wtflog.error("PageObjects need to implement '_validate_page(self, webdriver)' method: %s", e)
            raise e
        except Exception as e:
            _wtflog.debug("Unable to instantiate page: %s", e)
            raise e

        # Assign webdriver to PageObject.
        # Each page object has an instance of "webdriver" referencing the webdriver
        # driving this page.
        self.webdriver = webdriver

        # Take reference screenshots if this option is enabled.
        if config_reader.get("selenium.take_reference_screenshot", False) == True:
            class_name = type(self).__name__
            if class_name in PageObject.__names_of_classes_we_already_took_screen_caps_of__:
                pass
            else:
                try:
                    WebScreenShotUtil.take_reference_screenshot(
                        webdriver, class_name)
                    PageObject.__names_of_classes_we_already_took_screen_caps_of__[
                        class_name] = True
                except Exception as e:
                    # Some WebDrivers such as head-less drivers does not take
                    # screenshots.
                    _wtflog.error(e)
        else:
            pass
def __init__ ( self , webdriver , * args , ** kwargs ) : try : config_reader = kwargs [ 'config_reader' ] except KeyError : config_reader = WTF_CONFIG_READER try : self . _validate_page ( webdriver ) except TypeError as e : _wtflog . error ( "PageObjects need to implement '_validate_page(self, webdriver)' method: %s" , e ) raise e except Exception as e : _wtflog . debug ( "Unable to instantiate page: %s" , e ) raise e self . webdriver = webdriver if config_reader . get ( "selenium.take_reference_screenshot" , False ) == True : class_name = type ( self ) . __name__ if class_name in PageObject . __names_of_classes_we_already_took_screen_caps_of__ : pass else : try : WebScreenShotUtil . take_reference_screenshot ( webdriver , class_name ) PageObject . __names_of_classes_we_already_took_screen_caps_of__ [ class_name ] = True except Exception as e : _wtflog . error ( e ) else : pass
Constructor.  It's better to not call this directly, instead use PageFactory 
        to instantiate PageObjects.

        Args: 
            webdriver (Webdriver): Selenium Webdriver instance.