void GetDestination() { string address = AddrTxt.ToString(); string city = CityTxt.ToString(); string country = CountTxt.ToString(); string destination = address + ',' + city + ',' + country; string startAddress = AddrTxtStart.ToString(); string startCity = CityTxtStart.ToString(); string startCountry = CountTxtStart.ToString(); string startPlace = startAddress + ',' + startCity + ',' + startCountry; DistBox.Text = destination; StartPlaceBox.Text = startPlace; DateTime?nullDate = null; string date = nullDate.ToString(); ShippedDateBox.Text = date; var per1km = (float)Convert.ToDecimal(PerKmTxt.Text); var distance = (float)Convert.ToDecimal(DistTxt.Text); double price = per1km * distance; TotalPriceTxt.Text = price.ToString(); }
private void AddressTxt2_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { CityTxt.Focus(); e.Handled = true; e.SuppressKeyPress = true; } }
private void ClrBtn_Click(object sender, EventArgs e) { CstFNameTxt.Clear(); CstLNameTxt.Clear(); BuisTxt.Clear(); CstLLineTxt.Clear(); CstMobTxt.Clear(); FLineTxt.Clear(); SecLineTxt.Clear(); CityTxt.Clear(); CountyTxt.Clear(); PoCdTxt.Clear(); CstEmailTxt.Clear(); CusInvTxt.Clear(); }
/// <summary> /// Fills the required fields on the enter a CPD activity page /// </summary> /// public void FillOutAssessmentForm() { //generate the data to fill out the data DateTime dt = DateTime.Now; int currentDay = dt.Day; int currentMonth = dt.Month; int currentYear = dt.Year; int currentHour = dt.Hour; int currentMinute = dt.Minute; int currentSecond = dt.Second; //create a string for the program title String ProgramTitle = "TestRun_" + currentMonth + "_" + currentDay + "_" + currentYear + "-" + currentHour + ":" + currentMinute + ":" + currentSecond; Thread.Sleep(2000); ProgramTitleCertifiedAssessmentTxt.SendKeys(ProgramTitle); //move down to the province selection screen IWebElement element = Browser.FindElement(By.Id("ctl00_ContentPlaceHolder1_CFPCActivitiesWizard_ctl03_fb1_ctl06_ctl17_CEComboBox3449685")); // Put this element in the page bys class ElemSet.ScrollToElement(Browser, element); // MIKE: Removed a bunch of end lines //select alberta ProvinceSelectorDrpDn.SelectByIndex(1); ProvinceSelectorDrpDn.SelectByText("Alberta (AB)"); // MIKE: I added this line and commented the one above it. Why use index when you know which item you are going to choose? The index might change in the future if more items are added to the select list //Fill out the test city CityTxt.SendKeys("Test City"); //fill out the PlanningOrganizationTxt.SendKeys("Test"); //generate a date for these Activity Test string date = DateTime.Today.AddDays(-1).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture); // MIKE: I added this line and commented out the below lines. Reduces lines and having seperate varaibles for the start and end doesnt make sense in this case //DateTime dt2 = DateTime.Today.AddDays(-1); //String startDateText = dt2.Month + "/" + dt2.Day + "/" + dt2.Year; //String completionDateText = dt2.Month + "/" + dt2.Day + "/" + dt2.Year; //send the text to the box ActivityStartDateTxt.SendKeys(date); ActivityCompletionDateTxt.SendKeys(date); CreditsClaimedTxt.SendKeys("1"); ChangedImprovedRdo.Click(); LearnedNewRdo.Click(); LearnMoreRdo.Click(); //scroll to the dissatisfied radio button // ElemSet.ScrollToElement(Browser,DissatisfiedRdo); ElemSet.ClickAfterScroll(Browser, DissatisfiedRdo); // MIKE: I added this line and commented the above one. We can talk at meeting BiasedRdo.Click(); //scroll to element ElemSet.ClickAfterScroll(Browser, ConfirmedRdo); // MIKE: I would name these elements with a little more detail. It took me, a new person, a little bit of time to figure out what radio button was for each variable // MIKE: Always start with the beginning text when naming elements. For example for this radio button, name it "ThisExperienceConfirmedRdo" instead of just "Confirmed" // For some reason, whenever we use Selenium's built in click method here, it triggers the application to add more than // 1 credit for the activity/user (We entered "1" into the CreditsClaimed text box above, so only 1 credit should get // added for the user). I added a workaround to use the javascript version of a click, and this // works (only adds the specified amount of credits) For more info, // see https://stackoverflow.com/questions/24571048/selenium-webelement-click-vs-javascript-click-event JavascriptUtils.Click(Browser, SubmitButton); SubmitButton.SendKeys(Keys.Tab); Thread.Sleep(20000); // MIKE: Definitely add wait criteria here. I see that a popup appears, we can wait on an element in this popup }