org.openqa.selenium.browserlaunchers
Class LauncherUtils

java.lang.Object
  extended by org.openqa.selenium.browserlaunchers.LauncherUtils

public class LauncherUtils
extends Object

Various static utility functions used to launch browsers


Constructor Summary
LauncherUtils()
           
 
Method Summary
static void copyDirectory(File source, File dest)
           
protected static boolean copyDirectory(File source, String suffix, File dest)
          Copies all files matching the suffix to the destination directory.
static void copySingleFile(File sourceFile, File destFile)
           
static void copySingleFileWithOverwrite(File sourceFile, File destFile, boolean overwrite)
           
static File createCustomProfileDir(String sessionId)
          creates an empty temp directory for managing a browser profile
static File customProfileDir(String sessionId)
          Return the name of the custom profile directory for a specific seleniumm session
static void deleteTryTryAgain(File dir, int tries)
          Try several times to recursively delete a directory
static File extractHTAFile(File dir, int port, String resourceFile, String outFile)
           
static void generatePacAndPrefJs(File customProfileDir, int port, String homePage, boolean changeMaxConnections, long timeoutInSeconds, Capabilities capabilities)
           
static String getDefaultHTMLSuiteUrl(String browserURL, String suiteUrl, boolean multiWindow, int serverPort)
           
static String getDefaultRemoteSessionUrl(String startURL, String sessionId, boolean multiWindow, int serverPort, boolean browserSideLog)
           
static String getQueryString(String url)
           
static InputStream getSeleniumResourceAsStream(String resourceFile)
           
static boolean isScriptFile(File aFile)
           
static void recursivelyDeleteDir(File customProfileDir)
          Delete a directory and all subdirectories
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LauncherUtils

public LauncherUtils()
Method Detail

createCustomProfileDir

public static File createCustomProfileDir(String sessionId)
creates an empty temp directory for managing a browser profile


customProfileDir

public static File customProfileDir(String sessionId)
Return the name of the custom profile directory for a specific seleniumm session

Parameters:
sessionId - Current selenium sesssion id. Cannot be null.
Returns:
file path of the custom profile directory for this session.

recursivelyDeleteDir

public static void recursivelyDeleteDir(File customProfileDir)
Delete a directory and all subdirectories


deleteTryTryAgain

public static void deleteTryTryAgain(File dir,
                                     int tries)
Try several times to recursively delete a directory


getQueryString

public static String getQueryString(String url)

getDefaultHTMLSuiteUrl

public static String getDefaultHTMLSuiteUrl(String browserURL,
                                            String suiteUrl,
                                            boolean multiWindow,
                                            int serverPort)

getDefaultRemoteSessionUrl

public static String getDefaultRemoteSessionUrl(String startURL,
                                                String sessionId,
                                                boolean multiWindow,
                                                int serverPort,
                                                boolean browserSideLog)

extractHTAFile

public static File extractHTAFile(File dir,
                                  int port,
                                  String resourceFile,
                                  String outFile)

getSeleniumResourceAsStream

public static InputStream getSeleniumResourceAsStream(String resourceFile)

isScriptFile

public static boolean isScriptFile(File aFile)

copySingleFile

public static void copySingleFile(File sourceFile,
                                  File destFile)

copySingleFileWithOverwrite

public static void copySingleFileWithOverwrite(File sourceFile,
                                               File destFile,
                                               boolean overwrite)

copyDirectory

public static void copyDirectory(File source,
                                 File dest)

copyDirectory

protected static boolean copyDirectory(File source,
                                       String suffix,
                                       File dest)
Copies all files matching the suffix to the destination directory.

If no files match, and the destination directory did not already exist, the destination directory is still created, if possible.

Parameters:
source - the source directory
suffix - the suffix for all files to be copied.
dest - the destination directory

generatePacAndPrefJs

public static void generatePacAndPrefJs(File customProfileDir,
                                        int port,
                                        String homePage,
                                        boolean changeMaxConnections,
                                        long timeoutInSeconds,
                                        Capabilities capabilities)
                                 throws FileNotFoundException
Throws:
FileNotFoundException


Copyright © 2012. All Rights Reserved.