Exemplo n.º 1
0
        public void StartApplication(string firefoxPath, IEnumerable arguments, string profilePath)
        {
            Hashtable env = ProcessExt.GetStdEnvironmentVariables();

            env["TEMP"]                      = _working_dir;
            env["TMP"]                       = _working_dir;
            env["XRE_PROFILE_PATH"]          = profilePath;
            env["MOZ_NO_REMOTE"]             = "1";
            env["MOZ_CRASHREPORTER_DISABLE"] = "1";
            env["NO_EM_RESTART"]             = "1";

            //start the process
            _firefox_process = ProcessExt.Start(firefoxPath, arguments, null, env, false, true);

            //Waits for the port to be listening
            SysWaiter.Wait(200);
            if (!_endpoint.WaitForListening(15000, 100))
            {
                throw new Errors.TimeoutError("Firefox failed to open the listening port {0} within 15s", _endpoint);
            }
        }
Exemplo n.º 2
0
        static void CreateProfile(string binary_path, string appdata_dir, string profile_name, out string profile_dir)
        {
            Hashtable env = ProcessExt.GetStdEnvironmentVariables();

            env["MOZ_NO_REMOTE"] = "1";

            string[] args = { "-CreateProfile", profile_name };

            using (var p = ProcessExt.Start(binary_path, args, null, env, false, false)) {
                if (!p.WaitForExit(10000))
                {
                    throw new Errors.TimeoutError("Failed to create the profile. The process didn't exit within 10s.");
                }
            }

            var profiles = ParseExistingProfiles(appdata_dir);

            if (!profiles.TryGetValue(profile_name, out profile_dir))
            {
                throw new SeleniumError("Failed to create the profile: {0}", profile_name);
            }
        }
Exemplo n.º 3
0
        public void Start(string filename, bool hide = true)
        {
            Hashtable env = ProcessExt.GetStdEnvironmentVariables();

            env["TEMP"] = _temp_folder;
            env["TMP"]  = _temp_folder;

            string servicePath = Path.Combine(_library_dir, filename);

            if (!File.Exists(servicePath))
            {
                throw new Errors.FileNotFoundError(servicePath);
            }

            //Start the process
            _process = ProcessExt.Start(servicePath, _arguments, null, env, true, true);

            //Waits for the port to be listening
            if (!_endpoint.WaitForListening(10000, 150))
            {
                throw new Errors.TimeoutError("The driver failed to open the listening port {0} within 10s", _endpoint);
            }
        }