Class UiDriver

    • Constructor Detail

      • UiDriver

        public UiDriver()
    • Method Detail

      • start

        public abstract void start()
        start the driver
      • stop

        public abstract void stop()
        stop the driver
      • getFirefoxDriver

        public static FirefoxDriver getFirefoxDriver​(String url)
        Parameters:
        url - the URL to open
        Returns:
        new FirefoxDriver instance
      • getFirefoxDriver

        public static FirefoxDriver getFirefoxDriver​(String url,
                                                     String browserPath)
        Get instance of driver working with Firefox browser
        Parameters:
        url - the URL to open
        browserPath - the path to the browser starting file or the remote Selenium hub URL (eg. http://10.11.12.13:4444/wd/hub/)
        Returns:
        new FirefoxDriver instance
      • getFirefoxDriver

        public static FirefoxDriver getFirefoxDriver​(String url,
                                                     String browserPath,
                                                     String remoteSeleniumURL)
        Get instance of driver working with Firefox browser
        Parameters:
        url - the target application URL
        browserPath - the browser start path
        remoteSeleniumURL - the remote Selenium hub URL (eg. http://10.11.12.13:4444/wd/hub/)
        Returns:
        new FirefoxDriver instance
      • getInternetExplorerDriver

        public static InternetExplorerDriver getInternetExplorerDriver​(String url)
        Get instance of driver working with Internet Explorer browser
        Parameters:
        url - the URL to open
        Returns:
        new InternetExplorerDriver instance
      • getEdgeDriver

        public static EdgeDriver getEdgeDriver​(String url,
                                               String remoteSeleniumURL)
        Get instance of driver working with Edge browser
        Parameters:
        url - the URL to open
        remoteSeleniumURL - the remote selenium hub URL (eg. http://10.11.12.13:4444/wd/hub/)
        Returns:
        new EdgeDriver instance
      • getEdgeDriver

        public static EdgeDriver getEdgeDriver​(String url)
        Parameters:
        url - the URL to open
        Returns:
        new EdgeDriver instance
      • getInternetExplorerDriver

        public static InternetExplorerDriver getInternetExplorerDriver​(String url,
                                                                       String remoteSeleniumURL)
        Parameters:
        url - the URL to open
        remoteSeleniumURL - the remote selenium hub URL (eg. http://10.11.12.13:4444/wd/hub/)
        Returns:
        new InternetExplorerDriver instance
      • getChromeDriver

        public static ChromeDriver getChromeDriver​(String url)
        Get instance of driver working with Chrome browser
        Parameters:
        url - the URL to open
        Returns:
        new ChromeDriver instance
      • getChromeDriver

        public static ChromeDriver getChromeDriver​(String url,
                                                   String remoteSeleniumURL)
        Get instance of driver working with Chrome browser
        Parameters:
        url - the URL to open
        remoteSeleniumURL - the remote Selenium hub URL (eg. http://10.11.12.13:4444/wd/hub/)
        Returns:
        new ChromeDriver instance
      • getSafariDriver

        public static SafariDriver getSafariDriver​(String url)
        Get instance of driver working with Safari browser
        Parameters:
        url - the URL to open
        Returns:
        new SafariDriver instance
      • getSafariDriver

        public static SafariDriver getSafariDriver​(String url,
                                                   String remoteSeleniumURL)
        Parameters:
        url - the URL to open
        remoteSeleniumURL - the remote Selenium hub URL (eg. http://10.11.12.13:4444/wd/hub/)
        Returns:
        new SafariDriver instance
      • getHiddenBrowserDriver

        public static HiddenBrowserDriver getHiddenBrowserDriver​(String url)
        Parameters:
        url - the URL to open
        Returns:
        new HiddenBrowserDriver instance
      • getHiddenBrowserDriver

        public static HiddenBrowserDriver getHiddenBrowserDriver​(String url,
                                                                 com.gargoylesoftware.htmlunit.BrowserVersion browserVersion)
        Get instance of driver working with HiddenBrowser (headless browser)
        Parameters:
        url - the URL to open
        browserVersion - a BrowserVersion to emulate
        Returns:
        new HiddenBrowserDriver instance
      • getPhantomJSDriver

        @Deprecated
        public static PhantomJsDriver getPhantomJSDriver​(String url,
                                                         String browserPath)
        Deprecated.
        Parameters:
        url - the URL to open
        browserPath - the browser absolute path
        Returns:
        new PhantomJSDriver instance
      • getRobotDriver

        public static RobotDriver getRobotDriver()
        Returns:
        new RobotDriver instance
      • getSwingDriver

        public static SwingDriver getSwingDriver​(Class<?> mainClassOfTestedApplication)
        Get instance of driver working with Swing UI application
        Parameters:
        mainClassOfTestedApplication - the class containing the "main" method
        Returns:
        new SwingDriver instance
      • getSwingDriver

        public static SwingDriver getSwingDriver​(Class<?> mainClassOfTestedApplication,
                                                 String windowTitle)
        Parameters:
        mainClassOfTestedApplication - the class containing the "main" method
        windowTitle - the window title
        Returns:
        new SwingDriver instance
      • getSwingDriver

        public static SwingDriver getSwingDriver​(String windowTitle)
        Parameters:
        windowTitle - the window title
        Returns:
        new SwingDriver instance
      • getSwingDriver

        public static SwingDriver getSwingDriver​(String jnlpLocation,
                                                 boolean cacheEnabled)
        Driver for working with JNLP applications
        Parameters:
        jnlpLocation - JNLP location. It can be local JNLP file path or a remote url
        cacheEnabled - whether the JNLP is cached or not
        Returns:
        new SwingDriver instance
      • getMobileDriver

        public static MobileDriver getMobileDriver​(String deviceName,
                                                   String platformVersion,
                                                   String udid,
                                                   String host)
        Driver for working with mobile applications
        Parameters:
        deviceName - the kind of mobile device or emulator to use. You can use one of MobileDriver driver type constants.
        For example: MobileDriver.DEVICE_ANDROID_EMULATOR, MobileDriver.DEVICE_IPHONE_SIMULATOR or iPhone Retina 4-inch, Galaxy S4, ...
        On iOS, this should be one of the valid devices returned by instruments with instruments -s devices.
        platformVersion - mobile OS version. For example: 8.1, 4.4 ... For Android it could be skipped (null)
        udid - unique device identifier of the connected physical device or null for emulator/simulator usage
        host - the host address of the Appium server. null may be passed if you want to work with localhost emulator
        Returns:
        new MobileDriver instance
      • getMobileDriver

        public static MobileDriver getMobileDriver​(String deviceName,
                                                   String platformVersion,
                                                   String udid,
                                                   String host,
                                                   int port)
        Driver for working with mobile applications
        Parameters:
        deviceName - the kind of mobile device or emulator to use. You can use one of MobileDriver driver type constants.
        For example: MobileDriver.DEVICE_ANDROID_EMULATOR, MobileDriver.DEVICE_IPHONE_SIMULATOR or iPhone Retina 4-inch, Galaxy S4, ...
        On iOS, this should be one of the valid devices returned by instruments with instruments -s devices.
        platformVersion - mobile OS version. For example: 11.4, 8.1 ... For Android it could be skipped (null)
        udid - unique device identifier of the connected physical device or null for emulator/simulator usage
        host - the host address of the Appium server. null may be passed if you want to work with localhost emulator
        port - the port number of the Appium server
        Returns:
        new MobileDriver instance
      • getCustomDriver

        public static UiDriver getCustomDriver​(String driverClassName,
                                               Class<?>[] parameterTypes,
                                               Object[] constructorArguments)
                                        throws Exception
        This method allows you to load your own driver implementation which you can use as any other UI Engine driver
        Parameters:
        driverClassName - the full class name of the custom driver class
        parameterTypes - the parameters that the constructor requires
        constructorArguments - the arguments, which will be passed to the constructor
        Returns:
        new UiDriver instance
        Throws:
        Exception