public void EnterUserDetails(IWebDriver driver, string preferredTitle, string firstName, string lastName, string mobileNumber, string password, string confirmPassword) { // Select Title from dropdown list var title = driver.FindElement(By.Id("title")); var selectElement = new SelectElement(title); selectElement.SelectByValue(preferredTitle); // Enter First Name FirstNameBox.SendKeys(firstName); // Select Last Name LastNameBox.SendKeys(lastName); // Enter mobile number MobileNumberBox.SendKeys(mobileNumber); // Enter password PasswordBox.SendKeys(password); // Confirm password ConfirmPasswordBox.SendKeys(confirmPassword); }
private void RegistrationFinishButton_Click(object sender, EventArgs e) { if (LocalDestinationSelection.Checked) { try { if (string.IsNullOrEmpty(FirstnameBox.Text) || string.IsNullOrEmpty(LastnameBox.Text) || string.IsNullOrEmpty(AddressBox.Text) || string.IsNullOrEmpty(MobileNumberBox.Text) || string.IsNullOrEmpty(NICNumberBox.Text) || string.IsNullOrEmpty(PassportNumberBox.Text) || string.IsNullOrEmpty(OriginSelectionBox.Text) || string.IsNullOrEmpty(CabinClassSelectionBox.Text) || string.IsNullOrEmpty(LocalDestinationSelectionBox.Text) || string.IsNullOrEmpty(rdio)) { throw new ArgumentNullException(); } LOCAL_FLIGHT l1 = new LOCAL_FLIGHT(); c = l1.location_check(OriginSelectionBox.Text, LocalDestinationSelectionBox.Text); if (c) { throw new InvalidLocationException("Origin and destination location cannot be same"); } FLIGHT f1 = new LOCAL_FLIGHT(FirstnameBox.Text, LastnameBox.Text, AddressBox.Text, MobileNumberBox.Text, NICNumberBox.Text, PassportNumberBox.Text, OriginSelectionBox.Text, LocalDestinationSelectionBox.Text, CabinClassSelectionBox.Text, rdio); if (f1.register()) { f1.reader(); MessageBox.Show(f1.First_name + f1.Last_name + f1.Address + f1.Mobile_no + f1.Cnic + f1.Passport_no + f1.Origin + f1.Destination + f1.Cabin_class + f1.Way + f1.SeatNo); FLIGHT f3 = new LOCAL_FLIGHT(); } else { MessageBox.Show(CabinClassSelectionBox.Text + " SEATS FULL"); } FirstnameBox.Clear(); LastnameBox.Clear(); AddressBox.Clear(); MobileNumberBox.Clear(); NICNumberBox.Clear(); PassportNumberBox.Clear(); LocalDestinationSelection.Checked = false; InternationalDestinationSelection.Checked = false; OriginSelectionBox.ResetText(); LocalDestinationSelectionBox.ResetText(); InternationalDestinationSelectionBox.ResetText(); CabinClassSelectionBox.ResetText(); OneWay.Checked = false; Return.Checked = false; } catch (ArgumentNullException) { MessageBox.Show("Kindly Fill All The Fields"); } catch (InvalidLocationException ex) { MessageBox.Show(ex.Message); } catch (DirectoryNotFoundException) { MessageBox.Show("Directory not found reserve seat "); } catch (PathTooLongException) { MessageBox.Show("INVALID PASSPORT NUMBER"); } } if (InternationalDestinationSelection.Checked) { try { if (string.IsNullOrEmpty(FirstnameBox.Text) || string.IsNullOrEmpty(LastnameBox.Text) || string.IsNullOrEmpty(AddressBox.Text) || string.IsNullOrEmpty(MobileNumberBox.Text) || string.IsNullOrEmpty(NICNumberBox.Text) || string.IsNullOrEmpty(PassportNumberBox.Text) || string.IsNullOrEmpty(OriginSelectionBox.Text) || string.IsNullOrEmpty(CabinClassSelectionBox.Text) || string.IsNullOrEmpty(InternationalDestinationSelectionBox.Text) || string.IsNullOrEmpty(rdio)) { throw new ArgumentNullException(); } FLIGHT f2 = new INTERNATIONAL_FLIGHT(FirstnameBox.Text, LastnameBox.Text, AddressBox.Text, MobileNumberBox.Text, NICNumberBox.Text, PassportNumberBox.Text, OriginSelectionBox.Text, InternationalDestinationSelectionBox.Text, CabinClassSelectionBox.Text, rdio); if (f2.register()) { f2.reader(); MessageBox.Show(f2.First_name + f2.Last_name + f2.Address + f2.Mobile_no + f2.Cnic + f2.Passport_no + f2.Origin + f2.Destination + f2.Cabin_class + f2.Way + f2.SeatNo); } else { MessageBox.Show(CabinClassSelectionBox.Text + " SEATS FULL"); } FirstnameBox.Clear(); LastnameBox.Clear(); AddressBox.Clear(); MobileNumberBox.Clear(); NICNumberBox.Clear(); PassportNumberBox.Clear(); LocalDestinationSelection.Checked = false; InternationalDestinationSelection.Checked = false; OriginSelectionBox.ResetText(); LocalDestinationSelectionBox.ResetText(); InternationalDestinationSelectionBox.ResetText(); CabinClassSelectionBox.ResetText(); OneWay.Checked = false; Return.Checked = false; } catch (ArgumentNullException) { MessageBox.Show("Kindly Fill All The Fields"); } catch (DirectoryNotFoundException) { MessageBox.Show("Directory not found cannot reserve seat "); } catch (PathTooLongException) { MessageBox.Show("INVALID PASSPORT NUMBER"); } } }