Beispiel #1
0
 def goToUrl(self,url=""):
     """
         A method to go at specify URL.
         :param url: str
     """
     Driver.getInstance().get(url)
     return self
Beispiel #2
0
def __on_failure_screesnshot(cls):
    """
        Private method to take a Screenshot if an Assertion fails.
    """
    allure.attach(WebDriver.getInstance().get_screenshot_as_png(),
                  str(datetime.datetime.now()),
                  attachment_type=allure.attachment_type.PNG)
Beispiel #3
0
    def takeScreenshot(self,name=str(datetime.datetime.now())):
        """
            Take a screenshot in PNG format and attach it into allure report.
            Receive a name for the image. By default set the current timestamp for the name.

            :params name: str
        """
        allure.attach(Driver.getInstance().get_screenshot_as_png(),name,attachment_type=allure.attachment_type.PNG)
        return self
Beispiel #4
0
 def __setTextOnAlertMessage(self, message):
     """
         Set text in the current dialog displayed on the browser
     """
     Driver.getInstance().switch_to.alert.send_keys(message)
     
Beispiel #5
0
 def __getAlertMessage(self):
     """
         Get message from the current dialog displayed on the browser
     """
     return Driver.getInstance().switch_to.alert.text
Beispiel #6
0
 def declineAlert(self):
     """
         Cancel the current dialog displayed on the browser
     """
     Driver.getInstance().switch_to.alert.dismiss()
     return self
Beispiel #7
0
 def acceptAlert(self):
     """
         Accept the current dialog displayed on the browser
     """
     Driver.getInstance().switch_to.alert.accept()
     return self
Beispiel #8
0
 def closeBrowser(self):
     """
         A method to close the current Browser
     """
     Driver.closeDriver()
Beispiel #9
0
 def getTitle(self):
     """
         A method to get the title for the current page.
         :return: str
     """
     return Driver.getInstance().title
Beispiel #10
0
 def __getDriver(self):
     """
         Call for the instance of WebDriver to return it.
         :return: WebDriver
     """
     return WebDriver.getInstance()