public void login(string taikhoan, string matkhau) { m_UserName.Clear(); m_UserName.SendKeys(taikhoan); Thread.Sleep(1000); m_PasswordPhat.Clear(); m_PasswordPhat.SendKeys(matkhau + OpenQA.Selenium.Keys.Enter); Thread.Sleep(1000); m_thugom.Click(); Thread.Sleep(1000); m_thugomtudong.Click(); Thread.Sleep(5000); m_timkiemtrungtam.Click(); Thread.Sleep(1000); SeleniumSetMeThor.SelectDropDownVaules(cmbtimkiemtrungtam, "1580"); Thread.Sleep(1000); m_timkiemtrungtam.Click(); Thread.Sleep(1000); }
public int GanTuDong(string CustomerCode, string SenderPhone, string trungtam, string buucuc) { int kq = 0; Thread.Sleep(5000); m_themtudong.Click(); // PropretiesCollection.driver.SwitchTo().ActiveElement().FindElement(By.XPath("/html/body/div[4]/div[1]/div[2]/div/div/div[2]/div/button")).Click(); Thread.Sleep(10000); DefaultWait <IWebDriver> flusername = new DefaultWait <IWebDriver>(PropretiesCollection.driver); flusername.Timeout = TimeSpan.FromSeconds(10); flusername.PollingInterval = TimeSpan.FromMilliseconds(250); flusername.IgnoreExceptionTypes(typeof(NoSuchElementException)); IWebElement searchusername = flusername.Until(x => x.FindElement(By.Id("CustomerCode"))); if (searchusername != null) { m_txtCustomerCode.Clear(); m_txtCustomerCode.SendKeys(CustomerCode); Thread.Sleep(1000); m_txtSenderPhone.Clear(); m_txtSenderPhone.SendKeys(SenderPhone); Thread.Sleep(3000); try { m_cmbtrungtam.Click(); } catch { } try { m_cmbtrungtam1.Click(); } catch { } Thread.Sleep(1000); SeleniumSetMeThor.SelectDropDownVaules(cmbtrungtam, trungtam); Thread.Sleep(1000); try { m_cmbtrungtam.Click(); } catch { } try { m_cmbtrungtam1.Click(); } catch { } Thread.Sleep(1000); try { m_cmbbuucuc.Click(); } catch { } try { m_cmbbuucuc1.Click(); } catch { } Thread.Sleep(2000); SeleniumSetMeThor.SelectDropDownVaules(cmbbuucuc, buucuc); Thread.Sleep(1000); try { m_cmbbuucuc.Click(); } catch { } try { m_cmbbuucuc1.Click(); } catch { } Thread.Sleep(1000); try { btnthemtuyen.Click(); } catch { } try { btnthemtuyen1.Click(); } catch { } Thread.Sleep(1000); switch (kq) { case 0: System.Threading.Thread.Sleep(3000); goto case 1; break; case 1: try { string thongbao = SeleniumGetMeThor.GetText2(txtketqua); if (thongbao == "Cập nhật dữ liệu thành công") { kq = 1; } else if (thongbao.IndexOf("đã được thiết lập") != -1) { kq = 1; try { PropretiesCollection.driver.SwitchTo().ActiveElement().FindElement(By.XPath("/html/body/div[4]/div[7]/div/div/div/div[3]/button")).Click(); } catch { } Thread.Sleep(1000); try { PropretiesCollection.driver.SwitchTo().ActiveElement().FindElement(By.XPath("/html/body/div[4]/div[1]/div[2]/div/div/div[4]/div/div/div/div[3]/button[2]")).Click(); } catch { } Thread.Sleep(1000); try { PropretiesCollection.driver.SwitchTo().ActiveElement().FindElement(By.XPath("/html/body/div[4]/div[1]/div[2]/div/div/div[3]/div[2]/div/div/div/div[3]/button[2]")).Click(); } catch { } } else { goto case 0; } } catch { goto case 0; } break; } Thread.Sleep(4000); try { PropretiesCollection.driver.SwitchTo().ActiveElement().FindElement(By.XPath("/html/body/div[4]/div[7]/div/div/div/div[3]/button")).Click(); } catch { } } return(kq); }