Package core.helpers

Class PageHelper


  • public class PageHelper
    extends Object
    • Constructor Detail

      • PageHelper

        public PageHelper()
    • Method Detail

      • maximizePage

        public void maximizePage()
        maximizes web page
      • setPageSize

        public void setPageSize​(int x,
                                int y)
        sets page size
        Parameters:
        x -
        y -
      • refreshPage

        public void refreshPage()
        reload page
      • switchIframe

        public void switchIframe​(EnhancedBy frame)
        switches frame to frame specified
        Parameters:
        frame -
      • switchToDefaultFrame

        public void switchToDefaultFrame()
        switches to default frame
      • switchWindowHandle

        public static void switchWindowHandle​(int index)
        switch windows handle based on index
        Parameters:
        index -
      • dimissAlert

        public String dimissAlert()
        dismisses alert by selecting ok or cancel
        Parameters:
        alert -
      • acceptAlert

        public String acceptAlert()
        accepts alert by selecting ok or cancel
        Parameters:
        alert -
      • getAlertValue

        public String getAlertValue()
        returns alert message value
        Returns:
      • currentWindow

        public String currentWindow()
        return the current window handle
        Returns:
      • switchToNewWindow

        public void switchToNewWindow​(String defaultWindow)
        switch to the new opened window
        Parameters:
        defaultWindow -
      • CloseAndReturn

        public void CloseAndReturn​(String defaultWindow)
        close the window And return to the defaultWindow
        Parameters:
        defaultWindow -
      • refreshPageSource

        public void refreshPageSource()
        gets page source
      • verifyTitle

        public void verifyTitle​(String appTitle)
        verify page title
        Parameters:
        appTitle -
      • switchDriver

        public void switchDriver​(org.openqa.selenium.WebDriver driver)
        switch webdriver use for switching between different drivers
        Parameters:
        driver -
      • switchToNextTab

        public void switchToNextTab()
        switch to next tab circles back to initial tab if it reaches the last tab
      • switchToPreviousTab

        public void switchToPreviousTab()
        switch to previous tab circle back to the last tab
      • switchToTab

        public void switchToTab​(int index)
        switch to tab by index
      • verifyNumberOfTabs

        public void verifyNumberOfTabs​(int tabs)
        switch to tab by index
      • getPageTitle

        public String getPageTitle()
        returns the title of the page
        Returns:
      • getCurrentUrl

        public String getCurrentUrl()
        returns the current url
        Returns:
      • getPageSource

        public String getPageSource()
        gets page source
        Returns:
      • navigateBack

        public void navigateBack()
        navigates back
      • navigateForward

        public void navigateForward()
        navigate forward
      • deleteAllCookies

        public void deleteAllCookies()
        delete all cookies
      • deleteCookieNamed

        public void deleteCookieNamed​(String name)
        delete cookie named
        Parameters:
        name -
      • bringPageToFront

        public void bringPageToFront()
        brings current browser to front webdriver only
      • swtichUrl

        public void swtichUrl​(String url)
        navigate to a different url
        Parameters:
        url - destination url
      • navigateToUrl

        public void navigateToUrl​(String url)
        navigate to a different url
        Parameters:
        url - destination url
      • getClipboardData

        public String getClipboardData()
        retrieves the clip board data
        Returns:
      • quitCurrentDriver

        public void quitCurrentDriver()
        quits the current web driver
      • quitDriver

        public void quitDriver​(org.openqa.selenium.WebDriver driver)
        quit driver
        Parameters:
        driver -
      • quitAllCurrentTestDrivers

        public void quitAllCurrentTestDrivers()
        quits all drivers in the current test
      • isVisibleInViewport

        public Boolean isVisibleInViewport​(EnhancedBy by)
        returns true if the element is visible in the current page only for web applications
        Parameters:
        by -
        Returns:
      • isVisibleInViewport

        public Boolean isVisibleInViewport​(EnhancedBy by,
                                           int index)
        returns true if the element is visible in the current page only for web applications
        Parameters:
        by -
        Returns:
      • getWebdriver

        public org.openqa.selenium.WebDriver getWebdriver()
        get current webdriver
        Returns:
      • printStackTrace

        public void printStackTrace​(Throwable throwable)
        prints stack trace
        Parameters:
        trace -
      • scrollBottomPageBrowser

        public void scrollBottomPageBrowser()
        scroll to bottom of browser
      • scrollUpBrowser

        public void scrollUpBrowser​(int count)
        scroll up browser
      • scrollUpBrowser

        public void scrollUpBrowser()
        scroll up the browser
      • scrollDownBrowser

        public void scrollDownBrowser​(int count)
        scroll down browser
      • scrollDownBrowser

        public void scrollDownBrowser()
        scroll down the browser
      • scrollToWebElement

        public void scrollToWebElement​(EnhancedBy element)
        scroll to web element
        Parameters:
        element -
      • scrollToWebElement

        public void scrollToWebElement​(EnhancedBy element,
                                       int index)
        scroll to element
        Parameters:
        element -
        index -
      • isFirefox

        public boolean isFirefox()
      • isChrome

        public boolean isChrome()
      • isSafari

        public boolean isSafari()
      • isMicrosoftEdge

        public boolean isMicrosoftEdge()