static void Main(string[] args) { IAttach attach = new AttachController(); OutlookController outlookController = new OutlookController(attach); outlookController.Read(); throw new Exception(""); // IGmail gmail = new GmailController(attach); UserCredential credential; using (var stream = new FileStream(@pathinit + @"\client_secret.json", FileMode.Open, FileAccess.Read)) { try { // string credPath = System.Environment.GetFolderPath( //System.Environment.SpecialFolder.Personal); string credPath = pathinit; credPath = Path.Combine(credPath, ".credentials/gmail-dotnet-quickstart.json"); credential = GoogleWebAuthorizationBroker.AuthorizeAsync( GoogleClientSecrets.Load(stream).Secrets, Scopes, "user", CancellationToken.None, new FileDataStore(credPath, true)).Result; Console.WriteLine("Credential file saved to: " + credPath); } catch (Exception ex) { Console.Write(ex); throw; } } // Create Gmail API service. var service = new GmailService(new BaseClientService.Initializer() { HttpClientInitializer = credential, ApplicationName = ApplicationName, }); // Define parameters of request. UsersResource.LabelsResource.ListRequest request = service.Users.Labels.List("me"); // start read mail //UsersResource.MessagesResource.ListRequest requestMessage = service.Users.Messages.List("me"); //IList<Message> listMessage = requestMessage.Execute().Messages; IList <Message> listMessage = gmail.ListMessages(service, "me", "has:attachment"); foreach (var item in listMessage) { var res = gmail.GetMessage(service, "me", item.Id); gmail.GetAttachments(service, "me", res.Id); } Console.Read(); }
public void SetAttachedFile(string fileName) { GmailController controller = new GmailController(driver); string path = controller.GetFilePath(fileName); IWebElement attachFile = webDriverWait.Until(x => x.FindElement(this.attachFileLocator)); attachFile.SendKeys(path); }
public void SetAttachedFile(string fileName) { fluentWait = FluentWait.GetFluentWait(this.driver); IWebElement attachFile = fluentWait.Until(x => x.FindElement(this.attachFile)); GmailController controller = new GmailController(this.driver); string path = controller.GetFilePath(fileName); attachFile.SendKeys(path); }
private static void Main(string[] args) { Console.Title = _title; Console.BackgroundColor = ConsoleColor.Blue; Console.Clear(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(string.Format(@"{0}{0}{0}{0}{0}{0}{1}", Utils.Tab, _title)); string lineText = Utils.LineText("_", Console.WindowWidth); Console.WriteLine(lineText); var objEmailAccountCTL = new EmailAccountController(); var objEmailProfile = objEmailAccountCTL.GetProfile(); if (objEmailProfile == null) { Utils.ConsoleWriteError("FIND NOT FOUND YOUR EMAIL SETTINGS."); } else { Console.WriteLine(string.Format("HostOrIPAddress{0}: {1}", Utils.Tab, objEmailProfile.HostOrIPAddress)); Console.WriteLine(string.Format("Port{0}{0}: {1}", Utils.Tab, objEmailProfile.Port)); Console.WriteLine(string.Format("isSSL{0}{0}: {1}", Utils.Tab, objEmailProfile.isSSL)); Console.WriteLine(string.Format("EmailAddress{0}: {1}", Utils.Tab, objEmailProfile.User)); Console.WriteLine(""); Console.WriteLine(lineText); try { IGmailable objGmailCTL = new GmailController(objEmailProfile); objGmailCTL.FetchAttachment(); } catch (Exception ex) { Console.WriteLine(string.Format("ERROR{0}{0}: {1}", Utils.Tab, ex.Message)); Logger.WriteLog("ERROR " + ex.Message); } } Console.WriteLine(lineText); Console.WriteLine("DONE"); Thread.Sleep(300); }
public void SetUp() { this.driver = new ChromeDriver(); this.controller = new GmailController(this.driver); string firstMail = controller.GetFirstMail(); string firstPassword = controller.GetFirstPassword(); controller.StartGmail(); LoginMailPage loginMailPage = new LoginMailPage(this.driver); loginMailPage.SetMail(firstMail); LoginPasswordPage loginPasswordPage = loginMailPage.GoToPasswordPage(); loginPasswordPage.SetPassword(firstPassword); this.inboxGmailPage = loginPasswordPage.LoginClick(); }