(string localFile)
| 716 | } |
| 717 | |
| 718 | private string UploadFile(string localFile) |
| 719 | { |
| 720 | string base64zip; |
| 721 | try |
| 722 | { |
| 723 | using (MemoryStream fileUploadMemoryStream = new MemoryStream()) |
| 724 | { |
| 725 | using (ZipArchive zipArchive = new ZipArchive(fileUploadMemoryStream, ZipArchiveMode.Create)) |
| 726 | { |
| 727 | string fileName = Path.GetFileName(localFile); |
| 728 | zipArchive.CreateEntryFromFile(localFile, fileName); |
| 729 | } |
| 730 | base64zip = Convert.ToBase64String(fileUploadMemoryStream.ToArray()); |
| 731 | } |
| 732 | |
| 733 | Dictionary<string, object> parameters = new Dictionary<string, object>(); |
| 734 | parameters.Add("file", base64zip); |
| 735 | Response response = this.Execute(DriverCommand.UploadFile, parameters); |
| 736 | |
| 737 | response.EnsureValueIsNotNull(); |
| 738 | return response.Value.ToString()!; |
| 739 | } |
| 740 | catch (IOException e) |
| 741 | { |
| 742 | throw new WebDriverException("Cannot upload " + localFile, e); |
| 743 | } |
| 744 | } |
| 745 | } |
no test coverage detected