public void init() { au3.Run(Config.pathVip72); au3.WinWaitActive("[TITLE:VIP72 Socks Client]", "", 10); String hWnd = au3.WinGetHandle("[TITLE:VIP72 Socks Client]"); hwndSTR = "[HANDLE:" + hWnd.ToString() + "]"; au3.ControlSetText(hwndSTR, "", "[ID:303]", Config.userVip72); au3.ControlSetText(hwndSTR, "", "[ID:301]", Config.passVip72); au3.ControlClick(hwndSTR, "", "[ID:119]"); waitText(hwndSTR, "[ID:131]", "System ready", "ERROR", 30); }
public void OpenImageFromLocalFileSystem() { //Navigates the browser to given URL driver.Navigate().GoToUrl("https://images.google.com/"); string fullFilePath = @"C:\AutomationImages\Actual.jpg"; Console.WriteLine("Open File: " + fullFilePath); IWebElement searchByImageButton = driver.FindElement(By.XPath("//span[@id='qbi']")); searchByImageButton.Click(); IWebElement searchByImageWindow = driver.FindElement(By.XPath("//div[@id='qbp']")); IWebElement tabUploadImage = searchByImageWindow.FindElement(By.XPath("//div[@Class='qbtbha sl']")); tabUploadImage.Click(); IWebElement btnChoosefile = searchByImageWindow.FindElement(By.XPath("//input[@id='qbfile']")); btnChoosefile.Click(); System.Threading.Thread.Sleep(2000); AutoItX3 autoIT = new AutoItX3(); autoIT.WinWait("Open"); autoIT.WinActivate("Open"); autoIT.ControlFocus("Open", "", "[CLASS:Edit]"); autoIT.ControlSetText("Open", "", "[CLASS:Edit]", fullFilePath); //autoIT.Send(@"Actual.jpg"); autoIT.ControlClick("Open", "", "[CLASS:Button; Text: Open]"); }
public void loadFile(string filepath) { //дефолт расчитанный на firefox string titlewindow = "Выгрузка файла"; string labelcontrol = "Имя файла:"; if (pages.browsername == "chrome") { titlewindow = "Открытие"; labelcontrol = "Имя файла:"; } if (pages.browsername == "firefox") { titlewindow = "Выгрузка файла"; labelcontrol = "Имя файла:"; } List <int> logs = new List <int>(); AutoItX3 autoIt = new AutoItX3(); logs.Add(autoIt.WinWait(titlewindow, "", 10)); logs.Add(autoIt.ControlSetText(titlewindow, labelcontrol, "", filepath)); Console.WriteLine("новый лог:" + autoIt.WinGetTitle(titlewindow)); autoIt.WinActivate(titlewindow); logs.Add(autoIt.ControlSend(titlewindow, "", "", "{ENTER}")); Console.WriteLine("==============вывод ошибок========"); foreach (int temp in logs) { Console.WriteLine(temp); } Console.WriteLine("==============конец вывода========"); }
public static void UploadFile(string FilePath) { AutoItX3 AutoIT = new AutoItX3(); AutoIT.WinWaitActive("Open", "", 1500); AutoIT.ControlFocus("Open", "", "Edit1"); AutoIT.ControlSetText("Open", "", "Edit1", FilePath); AutoIT.ControlClick("Open", "", "Button1"); }
private void Configure(string appTitle, string Text, string cntrlWinAuth, string cntrlSQLAuth, string cntrlUser, string textUser, string cntrlPass, string textPass, string cntrlLicense, string textlicense, string cntrlBackup, string textBackup, string btnControl) { _robot.WinActivate(appTitle); // _robot.ControlFocus(appTitle, Text, cntrlSQLAuth); _robot.ControlSetText(appTitle, Text, cntrlUser, textUser); _robot.ControlSetText(appTitle, Text, cntrlPass, textPass); _robot.ControlSetText(appTitle, Text, cntrlLicense, textlicense); _robot.ControlSetText(appTitle, Text, cntrlBackup, textBackup); _robot.ControlFocus(appTitle, Text, btnControl); _robot.ControlClick(appTitle, Text, btnControl, "LEFT", 1); }
public Boolean UploadFiles() { IList <IWebElement> subList = rdriver.FindElements(By.XPath("//ul[@class='mc-tertiary-list secondary-action-menu']//li")); int length = subList.Count; for (int i = 0; i <= length; i++) { string actionMenu = rdriver.FindElement(By.XPath("//div[@id='pagelet-2']//li[1]")).Text; if (actionMenu == "Upload files") { rdriver.FindElement(By.XPath("//div[@id='pagelet-2']//li[1]")).Click(); break; } } //Selecting the file from the desktop path Thread.Sleep(5000); auto.WinActivate("Open"); auto.ControlFocus("Open", "", "Edit1"); string path = ConfigurationManager.AppSettings["Path"]; auto.ControlSetText("Open", "", "Edit1", path); auto.ControlClick("Open", "", "Button1"); Thread.Sleep(2000); auto.ControlFocus("Open", "", "DirectUIHWND2"); SendKeys.SendWait("^(a)"); Thread.Sleep(2000); string[] fileList = Directory.GetFiles(path); List <string> fileNameList = new List <string>(); for (int i = 0; i < fileList.Length; i++) { fileNameList.Add(Path.GetFileName(fileList[i])); } string[] fileNameArray = fileNameList.ToArray(); auto.ControlClick("Open", "", "Button1"); Thread.Sleep(20000); IList <IWebElement> totalFiles = rdriver.FindElements(By.XPath("//tbody[@class='mc-table-body mc-table-body-culled']//tr")); int filesCount = totalFiles.Count; // Console.WriteLine(filesCount); for (int j = 1; j <= filesCount; j++) { string fileName = rdriver.FindElement(By.XPath("//tr[" + (j) + "]//td[2]")).Text; Console.WriteLine(fileName); if (!fileNameArray.Contains(fileName)) { return(false); } } return(true); }
public static void AddAutoReplyVoice(string video) { PortalChromeDriver.ClickElementPerXpath(FollowedAutoReplyElement.tabvoice); PortalChromeDriver.ClickElementPerXpath(FollowedAutoReplyElement.autoreply_content); Thread.Sleep(2 * 1000); AutoItX3 au3 = new AutoItX3(); PortalChromeDriver.Wait(TimeSpan.FromSeconds(10)); au3.ControlFocus("Open", "", "Edit1"); au3.ControlSetText("Open", "", "Edit1", @"D:\Test case\Test case\测试素材\Test AMR\" + video); PortalChromeDriver.Wait(TimeSpan.FromSeconds(2)); au3.ControlClick("Open", "", "Button1"); PortalChromeDriver.Wait(TimeSpan.FromSeconds(5)); PortalChromeDriver.ClickElementPerXpath(FollowedAutoReplyElement.Bottom_Save); }
public static void AddAutoReplyImage(string image) { PortalChromeDriver.ClickElementPerXpath(FollowedAutoReplyElement.tabimage); PortalChromeDriver.ClickElementPerXpath(FollowedAutoReplyElement.autoreply_content); AutoItX3 au3 = new AutoItX3(); PortalChromeDriver.Wait(TimeSpan.FromSeconds(10)); au3.ControlFocus("Open", "", "Edit1"); au3.ControlSetText("Open", "", "Edit1", @"C:\Users\v-haxun\Desktop\Image\" + image); PortalChromeDriver.Wait(TimeSpan.FromSeconds(2)); au3.ControlClick("Open", "", "Button1"); PortalChromeDriver.Wait(TimeSpan.FromSeconds(5)); PortalChromeDriver.ClickElementPerXpath(FollowedAutoReplyElement.Bottom_Save); //Thread.Sleep(2 * 1000); }
public static void SendImage() { try { PortalChromeDriver.GetElementByXpath(HIPortalPageUIElement.addimg_hidden_input).Click(); AutoItX3 au3 = new AutoItX3(); PortalChromeDriver.Wait(TimeSpan.FromSeconds(10)); au3.ControlFocus("Open", "", "Edit1"); au3.ControlSetText("Open", "", "Edit1", @"C:\Users\v-haxun\Desktop\Test.png"); PortalChromeDriver.Wait(TimeSpan.FromSeconds(2)); au3.ControlClick("Open", "", "Button1"); PortalChromeDriver.Wait(TimeSpan.FromSeconds(5)); } catch (Exception e) { } }
/// <summary> /// Open a file from local system /// </summary> /// <param name="fullFilePath">Full path of the file (along with extension)</param> public static void OpenFile(string fullFilePath) { Console.WriteLine("Open File: " + fullFilePath); WndImagePro wndImagePro = new WndImagePro(); wndImagePro.SetFocus(); Keyboard.SendKeys("O", ModifierKeys.Control); System.Threading.Thread.Sleep(2000); AutoItX3 autoIT = new AutoItX3(); autoIT.WinWait("Open"); autoIT.WinActivate("Open"); autoIT.ControlFocus("Open", "", "[CLASS:Edit]"); autoIT.ControlSetText("Open", "", "[CLASS:Edit]", fullFilePath); //autoIT.Send(@"Actual.jpg"); // autoIT.ControlClick("Open", "", "[CLASS:Button; Text: Open]"); Keyboard.SendKeys("O", ModifierKeys.Alt); }
static void UploadLanesTemplate() { try { WebDriverWait wait = new WebDriverWait(webDriver, TimeSpan.FromSeconds(10)); IWebElement element = wait.ValidateControl("uploadBtn"); element.Click(); Thread.Sleep(1000); AutoItX3 autoIt = new AutoItX3(); autoIt.ControlFocus("Open", "", "Edit1"); Thread.Sleep(1000); autoIt.ControlSetText("Open", "", "Edit1", requestTemplatePath + fileName); Thread.Sleep(1000); autoIt.ControlClick("Open", "", "Button1"); } catch (Exception ex) { throw ex; } }
public static void AddMenu_Image() { try { PortalChromeDriver.ClickElementPerXpath(MenuElement.Send_Message); PortalChromeDriver.ClickElementPerXpath(MenuElement.tabImage); PortalChromeDriver.ClickElementPerXpath(MenuElement.ImageChoose); AutoItX3 au3 = new AutoItX3(); PortalChromeDriver.Wait(TimeSpan.FromSeconds(10)); au3.ControlFocus("Open", "", "Edit1"); au3.ControlSetText("Open", "", "Edit1", @"C:\Users\v-haxun\Desktop\Image\efwe.jpg"); PortalChromeDriver.Wait(TimeSpan.FromSeconds(2)); au3.ControlClick("Open", "", "Button1"); PortalChromeDriver.Wait(TimeSpan.FromSeconds(5)); } catch (Exception e) { throw new Exception(e.Message); } }
public bool ControlSetText(string appTitle, string texttoSet, string controltoSetText, string cntrlpnltomatch, string selectionMessage) { try { bool returnvalue = false; if (_robot.ControlGetText(appTitle, "", cntrlpnltomatch) == selectionMessage) { _robot.ControlFocus(appTitle, "", controltoSetText); _robot.ControlSetText(appTitle, "", controltoSetText, texttoSet); returnvalue = true; } Sleep(500); return(returnvalue); } catch (Exception) { return(false); } }
/// <summary> /// Upload image on server /// </summary> /// <param name="imagePath">Path to the file</param> /// <param name="millisecondsUploadTimeout">Amount of time will wait for upload file before failing a request</param> public void UploadImageFile(string imagePath, int millisecondsUploadTimeout) { btnChooseFiles.WaitUntilVisible(2000); int oldCountUploadedFiles = divUploadedFiles.FindElements(By.ClassName("file-name")).Count; btnChooseFiles.Click(); AutoItX3 autoIt = new AutoItX3(); if (autoIt.WinWait(TitleOpenFileDialog) == 0) { throw new NullReferenceException("OpenFileDialog can not be found."); } autoIt.ControlFocus(TitleOpenFileDialog, "", "Edit1"); autoIt.Sleep(500); autoIt.ControlSetText(TitleOpenFileDialog, "", "Edit1", imagePath); autoIt.ControlClick(TitleOpenFileDialog, "", "Button1"); int newCountUploadedFiles = 0; for (int i = 0; (i < millisecondsUploadTimeout) && (newCountUploadedFiles <= oldCountUploadedFiles); i += 500) { System.Threading.Thread.Sleep(500); newCountUploadedFiles = divUploadedFiles.FindElements(By.ClassName("file-name")).Count; } string info = "Upload: " + DateTime.Now.ToString() + " - " + Path.GetFileName(imagePath) + "\n"; if (oldCountUploadedFiles == newCountUploadedFiles) { throw new ErrorUploadImagesException("Error loading: " + info); } txtAdditionalRemarks.SendKeys(info); btnSave.Click(); }
public void CreateJob() { _Au3Lib.Opt("WinTitleMatchMode", 2); //Checks if the Order Log is open string windowTitle = "Order Log"; _Au3.CheckIfWindowExists(windowTitle); string windowNewOrderNumber = "New Order Number"; _Au3.ClickNewJobButton("Order Log", windowNewOrderNumber); //Determines customer number based on division _Au3Lib.ControlSetText(windowNewOrderNumber, "", "[NAME:txtCustNbr]", _Au3.GetCustomerNumber()); _Au3Lib.Send("{TAB}"); _Au3.DetermineControlVisibility("[NAME:lblCustName]", windowNewOrderNumber); //Sets the job name based on chosen job type DateTime currentDate = DateTime.Now; //string format = "m/d/yy"; string formattedDate = currentDate.ToShortDateString(); _Au3Lib.ControlClick(windowNewOrderNumber, "", "[NAME:txtOrdName]"); ///////MUST GET WITH RALPH ON HOW TO GET THIS TO READ COMBO BOX////////// //switch (ComboBox_jobType) //{ // default: //} string jobType = "A"; _Au3Lib.ControlSetText(windowNewOrderNumber, "", "[Name:txtOrdName]", "Test " + jobType + ",C:" + formattedDate); _Au3.SetCustomerContact(windowNewOrderNumber); //Call("Visibility", "[NAME:lblCustName]",$WindowTitle) //; Set Job Name and sets blank customer contact //$CurrentDate = _NowDate() //ControlClick($WindowTitle, "", "[NAME:txtOrdName]") //ControlSetText($WindowTitle, "", "[Name:txtOrdName]", "Test A, C:" & $CurrentDate) //Call("CustomerContact",$WindowTitle) //Sets category and Order type based on jobType chosen in ComboBox string category = "1"; string scheduleType = "O"; // sets to OSD _Au3.SetCatSchedType(category, scheduleType, windowNewOrderNumber); //Sets Order Entry date, primer to red, and saves the job _Au3.SetPrimerAndSave(windowNewOrderNumber); //If a pop-up shows up, warning there is no delivery schedule information, this dismisses it. _Au3.DismissNewOrderNumberPopUp(windowNewOrderNumber); _Au3.DetermineControlVisibility("[NAME:btnOrderEntry]", windowNewOrderNumber); _Au3.GoToOrderEntry(windowNewOrderNumber, "Order Log"); _Au3.DetermineControlVisibility("[NAME:btnNewJob]", "Order Log"); _Au3Lib.WinClose(windowNewOrderNumber); }
internal void EditListing() { Thread.Sleep(1000); //Populate the Excel Sheet ShareSkill GlobalDefinitions.ExcelLib.PopulateInCollection(@"C:\Users\JIJI\source\repos\marsframework-master\MarsFramework\ExcelData\TestDataShareSkill.xlsx", "ShareSkill"); int counts = 0; counts = Global.GlobalDefinitions.Driver.FindElements(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr")).Count; int check = 0; if (counts != 0) { for (var i = 1; i <= counts; i++) { IWebElement Title = Global.GlobalDefinitions.Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[3]")); IWebElement desc = Global.GlobalDefinitions.Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[4]")); if (Title.Text == GlobalDefinitions.ExcelLib.ReadData(2, "Title") && desc.Text == GlobalDefinitions.ExcelLib.ReadData(2, "Description")) { Global.GlobalDefinitions.Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr[1]/td[8]/div/button[2]/i")).Click(); Thread.Sleep(1500); //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollection(@"C:\Users\JIJI\source\repos\marsframework-master\MarsFramework\ExcelData\TestDataManageListings.xlsx", "EditManageListings"); //Update Title Global.GlobalDefinitions.Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[1]/div/div[2]/div/div[1]/input")).SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Update Description Global.GlobalDefinitions.Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[2]/div/div[2]/div[1]/textarea")).SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Enter Category Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[3]/div[2]/div/div/select")).Click(); Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[3]/div[2]/div/div/select/option[7]")).Click(); Driver.FindElement(By.XPath("/ html / body / div / div / div[1] / div[2] / div / form / div[3] / div[2] / div / div[2] / div[1] / select")).Click(); Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[3]/div[2]/div/div[2]/div[1]/select/option[5]")).Click(); //Enter Tags Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[4]/div[2]/div/div/div/div/input")).SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[4]/div[2]/div/div/div/div/input")).SendKeys(Keys.Enter); //Enter ServiceType String Service = GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType"); if (Service == "One-off service") { Driver.FindElement(By.XPath("/ html / body / div / div / div[1] / div[2] / div / form / div[5] / div[2] / div[1] / div[2] / div / input")).Click(); } else { Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[5]/div[2]/div[1]/div[1]/div/input")).Click(); } //Enter LocationType String LocationType = GlobalDefinitions.ExcelLib.ReadData(2, "LocationType"); if (LocationType == "On-site") { Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[6]/div[2]/div/div[1]/div/input")).Click(); } else { Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[6]/div[2]/div/div[2]/div/input")).Click(); } //Enter SkillTrade string SkillTrade = GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade"); if (SkillTrade == "Skill-Exchange") { Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[8]/div[2]/div/div[1]/div/label")).Click(); } else { Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[8]/div[2]/div/div[2]/div/label")).Click(); } //Enter Skill-Exchange Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[8]/div[4]/div/div/div/div/div/input")).SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[8]/div[4]/div/div/div/div/div/input")).SendKeys(Keys.Enter); //Enter Credit if (Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[8]/div[4]/div/div/div/div/div/input")).Text == "Credit") { Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[8]/div[4]/div/div/input")).SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit")); } ////Work Sample Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[9]/div/div[2]/section/div/label/div/span/i")).Click(); AutoItX3 autoit = new AutoItX3(); autoit.WinActivate("Open"); Thread.Sleep(1500); autoit.ControlSetText("Open", "", "Edit1", StrSendText); autoit.ControlClick("Open", "", "Button1"); //Enter Active string Active = GlobalDefinitions.ExcelLib.ReadData(2, "Active"); if (Active == "Active") { Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[10]/div[2]/div/div[1]/div/input")).Click(); } else { Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[10]/div[2]/div/div[2]/div/input")).Click(); } //Click on save Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[11]/div/input[1]")).Click(); Thread.Sleep(1500); manageListingsLink.Click(); check++; return; } } return; } }
// Create a new Property internal void CreateProperty() { Global.ExcelLib.PopulateInCollection(Config.PropertyManagementResource.ExcelPath, "Property"); //Explicit Wait Thread.Sleep(1000); //Click on Owners tab Owners.Click(); //Click Properties option Properties.Click(); //Click on Add New Property button AddPropertybtn.Click(); Thread.Sleep(500); // ************PropertyDetails*************** //Enter Property Name PropertyName.SendKeys(Global.ExcelLib.ReadData(2, "PropertyName")); Thread.Sleep(500); //Click on Property type dropdown PropertyTypeDropdown.Click(); //Select the value from property type dropdown PropertyTypedropdownvalue.Click(); //Enter Description Description.SendKeys(Global.ExcelLib.ReadData(2, "Description")); //Enter Street Number StreetNo.SendKeys(Global.ExcelLib.ReadData(2, "StreetNumber")); //Enter Street Name StreetName.SendKeys(Global.ExcelLib.ReadData(2, "StreetName")); //Enter Suburb Suburb.SendKeys(Global.ExcelLib.ReadData(2, "Suburb")); //Enter City City.SendKeys(Global.ExcelLib.ReadData(2, "City")); //Enter Postcode Postcode.SendKeys(Global.ExcelLib.ReadData(2, "PostCode")); //Enter Region Region.SendKeys(Global.ExcelLib.ReadData(2, "Region")); //Enter Target Rent TargetRent.SendKeys(Global.ExcelLib.ReadData(2, "TargetRent")); Thread.Sleep(1000); //Click on Rent drop down //RentTypeDropdown.Click(); //Select value from Rent dropdown // RentTypeDropdownvalue.Click(); //Enter Land Area LandArea.SendKeys(Global.ExcelLib.ReadData(2, "LandArea")); //Enter Floor Area FloorArea.SendKeys(Global.ExcelLib.ReadData(2, "FloorArea")); //Enter Bedroom Bedrooms.SendKeys(Global.ExcelLib.ReadData(2, "BedRooms")); //Enter Bathroom Bathrooms.SendKeys(Global.ExcelLib.ReadData(2, "BathRooms")); //Enter CarParks Carparks.SendKeys(Global.ExcelLib.ReadData(2, "CarParks")); Thread.Sleep(1000); //Enter Year built YearBuilt.SendKeys(Global.ExcelLib.ReadData(2, "YearBuilt")); // File Upload Approach1: Send Keys /* * FileUploadbtn.SendKeys(@"C:\Users\Shahabuddin\Desktop\Rumana\testiamge.jpg"); * Thread.Sleep(1000); * photo.Click(); */ // File Upload Approach2: AutoIt- Handles windows that do not belong to browser photo.Click(); FileUploadbtn.Click(); AutoItX3 AutoIt = new AutoItX3(); AutoIt.ControlFocus("Open", "", "Edit1"); Thread.Sleep(2000); AutoIt.ControlSetText("Open", "", "Edit1", @"C:\Users\Shahabuddin\Desktop\Rumana\house2_image.jpg"); Thread.Sleep(1000); AutoIt.ControlClick("Open", "", "Button1"); //Click on Next button NextbtnProptertyDetails.Click(); // ************Financialdetails*************** //Enter Purchase Price purchaseprice.SendKeys(Global.ExcelLib.ReadData(2, "PurchasePrice")); //Enter Mortgage Mortgage.SendKeys(Global.ExcelLib.ReadData(2, "Mortgage")); //HomeValue HomeValue.SendKeys(Global.ExcelLib.ReadData(2, "HomeValue")); //Click on Home Value Type drop down HomeValueType.Click(); //Select Home Value type HomeValueTypeSelection.Click(); //Click on Add Repayment button AddRePayment.Click(); //Enter Amount RePaymentAmount.SendKeys(Global.ExcelLib.ReadData(2, "RepaymentAmount")); //Enter RepaymentStartDate RePaymentStartdate.Clear(); RePaymentStartdate.SendKeys("26/05/2018"); Thread.Sleep(500); //Enter RepaymentEndDate RePaymentEnddate.Clear(); RePaymentEnddate.SendKeys("29/06/2018"); Thread.Sleep(500); //Click on Add Expense link AddExpense.Click(); //Enter Expense Amount ExpenseAmount.SendKeys(Global.ExcelLib.ReadData(2, "ExpenseAmount")); // Enter Expense Description ExpenseDescription.SendKeys(Global.ExcelLib.ReadData(2, "ExpenseDescription")); //Enter date for ExpenseDate //ExpenseDateCalender.Clear(); ExpenseDateCalender.SendKeys("30/06/2018"); Thread.Sleep(500); //Click on Next button NextbtnFinanceDetails.Click(); // ************Tenantdetails*************** //Enter TenantEmail TenantEmail.SendKeys(Global.ExcelLib.ReadData(2, "TenantEmail")); //Click on IsmainTenant IsMainTenant.Click(); //Select IsmainTenant IsMainTenantSelectYes.Click(); //Enter Tenant FirstName TenantFirstName.SendKeys(Global.ExcelLib.ReadData(2, "TenantFirstName")); //Enter Tenant LastName TenantLastName.SendKeys(Global.ExcelLib.ReadData(2, "TenantLastName")); //Enter Tenant StartDate TenantStartDate.Clear(); TenantStartDate.SendKeys("20/06/2018"); //Enter Tenant EndDate TenantEndDate.Clear(); TenantEndDate.SendKeys("30/09/2018"); //Enter TenantRentAmount TenantRentAmount.SendKeys(Global.ExcelLib.ReadData(2, "TenantRentAmount")); Thread.Sleep(1000); //Click on PaymentfrequencyDropdown //PaymentFrequencydropdown.Click(); //Select Monthly from PaymentFrequencyDropdown //PaymentFrequencydropdownMonth.Click(); //TenantPaymentStartdate TenantPaymentStartdate.Clear(); TenantPaymentStartdate.SendKeys("10/07/2018"); Thread.Sleep(1000); //Click on PaymentDueDay drop down //PaymentDueDayDropdown.Click(); //Select PaymentDueDay value //PaymentDueDayDropdownvalue.Click(); //Click on AddNewLiabilityLink AddNewLiability.Click(); //Click on LiabilityNameDropDown // LiabilityNameDropdown.Click(); //Select Liability Name Dropdown value //LiabilityNameDropdownInsurance.Click(); //Enter LiabilityAmount //LiabilityAmount.SendKeys(Global.ExcelLib.ReadData(2,"LiabilityAmount")); try { Assert.IsTrue(SavePropertyButton.Displayed); } catch (Exception e) { Console.Write(e); } //Click on Save button SavePropertyButton.Click(); //Add Property Verification //Click on Owners tab Owners.Click(); //Click Properties option Properties.Click(); string msg1 = Global.GlobalDefinition.driver.FindElement(By.XPath("//*[@id='main-content']/section/div[1]/div/div[3]/div/div[1]/div/div/div[2]/div[1]/div[1]/a/h3")).Text; string Actmsg = Global.ExcelLib.ReadData(2, "CreatePropertyVerification"); Thread.Sleep(2000); if (msg1 == Actmsg) { Global.Base.test.Log(LogStatus.Pass, "Test Passed, Record has been created successfully"); Global.SaveScreenShotClass.SaveScreenshot(Global.GlobalDefinition.driver, "PropertyListAdded"); } else { Global.Base.test.Log(LogStatus.Pass, "Test Failed, Record has not created"); } }
public void CustomerNumber(string windowNewOrderEntry, string customerNumber) { _Au3Lib.ControlClick(windowNewOrderEntry, "", "[NAME:txtCustNbr]"); _Au3Lib.ControlSetText(windowNewOrderEntry, "", "[NAME:txtCustNbr]", customerNumber); _Au3Lib.Send("{TAB}"); }
internal void EnterShareSkill() { int rows; rows = GlobalDefinitions.ExcelLib.NumberofRows(@"C:\Users\JIJI\source\repos\marsframework-master\MarsFramework\ExcelData\TestDataShareSkill.xlsx", "ShareSkill"); //Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(@"C:\Users\JIJI\source\repos\marsframework-master\MarsFramework\ExcelData\TestDataShareSkill.xlsx", "ShareSkill"); Thread.Sleep(1500); for (int i = 2; i <= rows + 1; i++) { Thread.Sleep(1500); //Click on Share Skill ShareSkillButton.Click(); //Enter Title Thread.Sleep(3500); Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Title")); //Enter Description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Description")); //Enter Category CategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Category")); //Enter Sub-Category SubCategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "SubCategory")); //Enter Tags Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Tags")); Tags.SendKeys(Keys.Enter); //Enter ServiceType String Service = GlobalDefinitions.ExcelLib.ReadData(i, "ServiceType"); if (Service == "One-off service") { ServiceTypeOptions.FindElement(By.XPath("/ html / body / div / div / div[1] / div[2] / div / form / div[5] / div[2] / div[1] / div[2] / div / input")).Click(); } else { ServiceTypeOptions.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[5]/div[2]/div[1]/div[1]/div/input")).Click(); } //Enter LocationType String LocationType = GlobalDefinitions.ExcelLib.ReadData(i, "LocationType"); if (LocationType == "On-site") { LocationTypeOption.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[6]/div[2]/div/div[1]/div/input")).Click(); } else { LocationTypeOption.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[6]/div[2]/div/div[2]/div/input")).Click(); } //Enter Startdate //StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate").ToString()); //Enter Enddate // EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")); //Enter Selectday // String Day=GlobalDefinitions.ExcelLib.ReadData(2, "Selectday"); //if(Day== "Sun") //{ // Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[2]/div[1]/div/input")).Click(); //} //else if(Day=="Mon") //{ // Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[3]/div[1]/div/input")).Click(); // } //else if (Day == "Tue") //{ // Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[4]/div[1]/div/input")).Click(); //} //else if (Day == "Wed") //{ // Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[5]/div[1]/div/input")).Click(); //} //else if (Day == "Thu") //{ // Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[6]/div[1]/div/input")).Click(); //} //else if (Day == "Fri") //{ // Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[7]/div[1]/div/input")).Click(); //} //else if (Day == "Sat") //{ // Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[8]/div[1]/div/input")).Click(); //} //Enter Starttime // StartTimeDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Starttime")); //Enter Endtime // EndTimeDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Endtime")); //Enter SkillTrade string SkillTrade = GlobalDefinitions.ExcelLib.ReadData(i, "SkillTrade"); if (SkillTrade == "Skill-Exchange") { SkillTradeOption.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[8]/div[2]/div/div[1]/div/label")).Click(); } else { SkillTradeOption.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[8]/div[2]/div/div[2]/div/label")).Click(); } //Enter Skill-Exchange SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Skill-Exchange")); SkillExchange.SendKeys(Keys.Enter); //Enter Credit if (SkillExchange.Text == "Credit") { CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Credit")); } ////Work Sample Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[9]/div/div[2]/section/div/label/div/span/i")).Click(); AutoItX3 autoit = new AutoItX3(); autoit.WinActivate("Open"); Thread.Sleep(1500); autoit.ControlSetText("Open", "", "Edit1", StrSendText); autoit.ControlClick("Open", "", "Button1"); //Enter Active string Active = GlobalDefinitions.ExcelLib.ReadData(i, "Active"); if (Active == "Active") { ActiveOption.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[10]/div[2]/div/div[1]/div/input")).Click(); } else { ActiveOption.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[10]/div[2]/div/div[2]/div/input")).Click(); } //Click on save Save.Click(); Thread.Sleep(1500); } }