public ShoppingCart DoQuickAddToCart() { //FindElement(By.Id("quickOrderViewAddAllToCartAndCheckOutButton")).Click(); IWebElement quickAddToCartBtn = FindElement(By.Id("quickOrderViewAddAllToCartAndCheckOutButton")); testEnv.GetScriptExecutor().Click(quickAddToCartBtn); WaitUtil.WaitForElementPresence(driver, By.XPath("//h1[text()='Shopping Cart']")); return(new ShoppingCart(testEnv)); }
public Rexnord Login(string user, string pwd) { driver.FindElement(By.LinkText(SIGN_IN_LINK)).Click(); driver.FindElement(By.Id(USER_NAME_ID)).SendKeys(user); driver.FindElement(By.Id(PASSWORD_ID)).SendKeys(pwd); driver.FindElement(By.Id("userNamePasswordSignInButton")).Click(); //WaitUtil.WaitForElementPresence(driver, By.LinkText("My Account")); WaitUtil.WaitForPageLoad(driver); return(new Rexnord(testEnv)); }
public bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser) { var chromiumWebBrowser = (ExtChromiumBrowser)browserControl; chromiumWebBrowser.Dispatcher.Invoke(new Action(() => { BrowserPopupWin win = new BrowserPopupWin(); win.ShowInTaskbar = false; win.Height = 0; win.Width = 0; win.Show(); IntPtr handle = new WindowInteropHelper(win).Handle; windowInfo.SetAsChild(handle); _scheduler.Run(() => { WaitUtil.Wait(() => chromiumWebBrowser.PostData); IRequest request = null; if (chromiumWebBrowser.PostData != null) { request = frame.CreateRequest(); request.Url = targetUrl; request.Method = "POST"; request.InitializePostData(); var element = request.PostData.CreatePostDataElement(); element.Bytes = chromiumWebBrowser.PostData; request.PostData.AddElement(element); chromiumWebBrowser.PostData = null; } chromiumWebBrowser.Dispatcher.Invoke(new Action(() => { NewWindowEventArgs e = new NewWindowEventArgs(targetUrl, request); chromiumWebBrowser.OnNewWindow(e); })); chromiumWebBrowser.Dispatcher.Invoke(new Action(() => { win.Close(); })); }); })); newBrowser = null; return(false); }
public void Refresh() { mItems = new List <RectTransform>(); foreach (RectTransform item in mScrollView.content) { if (item.gameObject.activeSelf) { mItems.Add(item); } } if (mItems == null || mItems.Count == 0) { gameObject.SetActive(false); return; } else { WaitUtil.Start(0.03f, (a) => { mContentAnchoredXMin = -100000; mContentAnchoredXMax = 100000; for (int i = 0; i < mItems.Count; i++) { float itemLeftBorder = mItems[i].BotLeft().x; if (itemLeftBorder < mContentAnchoredXMax) { mContentAnchoredXMax = itemLeftBorder; } float rightBorderX = mItems[i].TopRight().x; float maxRightContentX = rightBorderX - mScrollView.viewport.rect.width; if (maxRightContentX > mContentAnchoredXMin) { mContentAnchoredXMin = maxRightContentX; } } mContentAnchoredXMax *= -1; mContentAnchoredXMin *= -1; mScrollView.StopMovement(); mScrollView.content.SetX(mContentAnchoredXMax); }); } #if USE_DOTWEEN DOTween.Kill(GetInstanceID()); #endif mIsDraging = false; mIsSnapping = false; }
public void MoveToItem(int pIndex, bool pImmediately) { if (pIndex < 0 || pIndex >= m_Items.Count) { return; } if (m_Validated) { SetFocusedIndex(pIndex); MoveToFocusedItem(pImmediately, m_SpringThreshold); } else { WaitUtil.Start(() => m_Validated, () => { SetFocusedIndex(pIndex); MoveToFocusedItem(pImmediately, m_SpringThreshold); }); } }
public void Load(string url) { if (!string.IsNullOrWhiteSpace(url)) { loadingWait.Visibility = Visibility.Visible; Url = url; _scheduler.Run(() => { #region Wait WaitUtil.Wait(() => { if (this._browser == null) { return(false); } if (!this._browser.IsInitialized) { return(false); } if (!_isCefInited) { return(false); } bool isBrowserInitialized = false; this.Dispatcher.Invoke(() => { isBrowserInitialized = this._browser.IsBrowserInitialized; }); if (!isBrowserInitialized) { return(false); } return(true); }); #endregion _browser.Load(Url); }); } }
public void AssertTrialVersionWindowIsOpen(string windowName) { string window; switch (windowName) { case "Main": window = ConfigurationManager.AppSettings["MainWindowName"]; break; case "Trial version welcome": window = ConfigurationManager.AppSettings["ModalWindowName"]; break; default: window = windowName; break; } var isWindowOpen = WaitUtil.WaitForCondition(() => WindowBl.IsDefaultWindowOpen(window)); AssertionUtil.AssertTrue(isWindowOpen, $"{windowName} is not open"); }
protected BasePage(IWebDriver webDriver) { WebDriver = webDriver; seleniumactions = new Seleniumactions(webDriver); waitUtil = new WaitUtil(WebDriver); }
protected IWebElement FindElement(By by) { WaitUtil.WaitForElementPresence(driver, by); return(driver.FindElement(by)); }
public QuickOrder DoQuickOrder() { FindElement(By.LinkText("Quick Order")).Click(); WaitUtil.WaitForPageLoad(driver); return(new QuickOrder(testEnv)); }
public void AssertAppIsClosed() { var hasExited = WaitUtil.WaitForCondition(() => Scope.Application.Application.HasExited); AssertionUtil.AssertTrue(hasExited, "App is not stopped yet"); }
private void LoadUrl() { if (_firstLoad) { _firstLoad = false; _scheduler.Run(() => { #region Wait WaitUtil.Wait(() => { if (this._browser == null) { return(false); } if (!this._browser.IsInitialized) { return(false); } if (!_isCefInited) { return(false); } bool isBrowserInitialized = false; this.Dispatcher.Invoke(() => { isBrowserInitialized = this._browser.IsBrowserInitialized; }); if (!isBrowserInitialized) { return(false); } return(true); }); #endregion if (Url == null && SetUrlEvent != null) { try { SetUrlEvent(this, null); } catch (Exception ex) { LogUtil.Error(ex, "BrowserCtrl LoadUrl error 获取URL失败"); } } else { this.Dispatcher.Invoke(new Action(() => { loadingWait.Visibility = Visibility.Collapsed; })); } if (Url != null) { try { if (Request == null) { _browser.Load(Url); } else { _browser.Load(Url); _browser.GetMainFrame().LoadRequest(Request); Request = null; } } catch (Exception ex) { LogUtil.Error(ex, "BrowserCtrl LoadUrl error Load URL失败"); } } else { this.Dispatcher.Invoke(new Action(() => { loadingWait.Visibility = Visibility.Collapsed; })); } }); } }