public void Execute(Arguments arguments) { try { SeleniumWrapper wrapper = SeleniumManager.CreateWrapper( "chrome", "https://web.whatsapp.com/", arguments.Timeout.Value, false, Scripter.Log, Scripter.Settings.UserDocsAddonFolder.FullName); int wrapperId = wrapper.Id; OnScriptEnd = () => { SeleniumManager.DisposeAllOpenedDrivers(); SeleniumManager.RemoveWrapper(wrapperId); SeleniumManager.CleanUp(); }; } catch (Exception ex) { throw new ApplicationException($"Error occured while opening new selenium instance. Message: {ex.Message}", ex); } }
public static void RemoveWrapper(SeleniumWrapper wrapper) { wrappers.Remove(wrapper); wrapper = null; }
public static void Quit(SeleniumWrapper wrapper) { wrapper.Quit(); RemoveWrapper(wrapper); }