override protected Response Execute(string driverCommandToExecute, Dictionary <string, object> parameters) { Response commandResponse = new Response(); if (driverCommandToExecute == DriverCommand.NewSession) { var json = File.ReadAllText($"{CommonRemoteDriver.GetReusableRemoteWebdriverDirectory()}/default.json"); commandResponse = Response.FromJson(json); var definition = new { SessionId = "", Status = 0, IsSpecificationCompliant = false }; var session = JsonConvert.DeserializeAnonymousType(json, definition); commandResponse.SessionId = session.SessionId; } else { commandResponse = base.Execute(driverCommandToExecute, parameters); } return(commandResponse); }
protected override Response Execute(string driverCommandToExecute, Dictionary <string, object> parameters) { Response commandResponse = new Response(); if (driverCommandToExecute == DriverCommand.NewSession) { var filePath = $"{CommonRemoteDriver.GetReusableRemoteWebdriverDirectory()}/default.json"; commandResponse = base.Execute(driverCommandToExecute, parameters); Directory.CreateDirectory(CommonRemoteDriver.GetReusableRemoteWebdriverDirectory()); if (File.Exists(filePath)) { File.Delete(filePath); } File.Create(filePath).Dispose(); File.WriteAllText(filePath, commandResponse.ToJson()); } else { commandResponse = base.Execute(driverCommandToExecute, parameters); } return(commandResponse); }