private void ButtonFinish_IsVisibleChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e) { if (ButtonFinish.IsVisible) { ButtonFinish.Focus(); } }
public void TaoBussiness(string mail) { driver.Navigate().GoToUrl("https://business.facebook.com/overview"); if (library.IsAjaxLoaded() && library.IsLoadingComplete()) { try { if (library.ElementIsVisible(ButtonTaoTaiKhoan)) { ButtonTaoTaiKhoan.Click(); } else if (library.ElementIsVisible(ButtonTaoTaiKhoanDaCo)) { ButtonTaoTaiKhoanDaCo.Click(); } } catch (Exception ex) { Email = "Lỗi tạo tài khoản!!"; driver.Close(); return; } if (library.ElementsIsVisible(By.XPath("//input[@class='_4b7k _4b7k_big _53rs']"))) { string[] str = CompanyInfo[1].GetAttribute("value").ToString().Split('0'); try { string strName = str.Length > 1 ? str[0] + " 0" + int.Parse(str[1]).ToString() + 1 : str[0] + " 01"; if (library.ElementIsVisible(CompanyForm[0])) { CompanyInfo[0].SendKeys(strName); } if (library.ElementIsVisible(CompanyForm[2])) { CompanyInfo[2].SendKeys(mail); } } catch { CompanyInfo[0].SendKeys(CompanyInfo[1].GetAttribute("value").ToString()); CompanyInfo[2].SendKeys(mail); } if (library.ElementIsVisible(ButtonContinue)) { ButtonContinue.Click(); if ( library.IsAjaxLoaded() && library.ElementsIsVisible(By.XPath("//div//div//div//div//div//div//div//div//div//div//label//input[@class='_4b7k _4b7k_big _53rs']"))) { // Input form if (library.ElementIsVisible(CompanyForm[1])) { CompanyForm[1].SendKeys(RandomString(20)); } if (library.ElementIsVisible(CompanyForm[2])) { CompanyForm[2].SendKeys(RandomString(20)); } if (library.ElementIsVisible(CompanyForm[3])) { CompanyForm[3].SendKeys(RandomString(20)); } if (library.ElementIsVisible(CompanyForm[4])) { CompanyForm[4].SendKeys(RandomString(20)); } if (library.ElementIsVisible(CompanyForm[5])) { CompanyForm[5].SendKeys("0385102879"); } if (library.ElementIsVisible(CompanyForm[6])) { CompanyForm[6].SendKeys("https://www.24h.com.vn/"); } if (library.ElementIsVisible(CompanyForm[0])) { CompanyForm[0].SendKeys(RandomString(20)); } if (library.ElementIsVisible(ButtomCombobox)) { ButtomCombobox.Click(); if (library.ElementIsVisible(CountryText)) { CountryText.SendKeys("Vi"); if (library.ElementsIsVisible(By.XPath("//div//div//div//div//div//div//span//div//div//div//div//div//div"))) { if (library.IsAjaxLoaded() && library.ElementIsVisible(ListCountry[0])) { ListCountry[0].Click(); } } else { Email = "Chọn quốc gia thất bại"; driver.Close(); return; } } else { Email = "Chọn quốc gia thất bại"; driver.Close(); return; } } else { Email = "Chọn quốc gia thất bại"; driver.Close(); return; } if (library.ElementsIsVisible(By.XPath("//div//span//div//div//button"))) { if (library.ElementIsVisible(ButtonSubmit[1])) { ButtonSubmit[1].Click(); if (library.IsAjaxLoaded() && library.IsLoadingComplete() && library.IsLoadingComplete()) { if (library.ElementIsVisible(ButtonFinish)) { ButtonFinish.Click(); } if (library.IsAjaxLoaded() && library.IsLoadingComplete()) { Email = "Thành công!!"; // driver.Close(); // Console.WriteLine("12312"); // TO BE CONTINUE. } } } else { Email = "Gửi submit thất bại!!"; driver.Close(); return; } } } } else { Email = "Click tiếp tục thất bại"; driver.Close(); return; } } else { Email = "Nhập thông tin BM thất bại"; driver.Close(); return; } } else { Email = "Tài khoản đã được tạo"; driver.Close(); return; } }