internal void TryRestoreScrollbars()
 {
     if (configuration_.HideScrollbars)
     {
         ((EyesWebDriverTargetLocator)driver_.SwitchTo()).Frames(frameChain_);
         FrameChain fc = frameChain_.Clone();
         if (fc.Count > 0)
         {
             while (fc.Count > 0)
             {
                 Frame frame = fc.Pop();
                 frame.ReturnToOriginalOverflow(driver_);
                 EyesWebDriverTargetLocator.ParentFrame(logger_, driver_.RemoteWebDriver.SwitchTo(), fc);
             }
         }
         else
         {
             if (originalOverflow_ != null)
             {
                 logger_.Verbose("returning overflow of element to its original value: {0}", scrollRootElement_);
                 EyesSeleniumUtils.SetOverflow(originalOverflow_, driver_, scrollRootElement_);
             }
         }
         ((EyesWebDriverTargetLocator)driver_.SwitchTo()).Frames(frameChain_);
         logger_.Verbose("done restoring scrollbars.");
     }
     else
     {
         logger_.Verbose("no need to restore scrollbars.");
     }
 }
        public void Restore()
        {
            EyesWebDriverTargetLocator switchTo = (EyesWebDriverTargetLocator)driver_.SwitchTo();

            switchTo.Frames(frameChain_);

            cssPositionProvider_.RestoreState(cssMemento_);
            scrollPositionProvider_.RestoreState(scrollMemento_);
            driver_.ExecuteScript($"arguments[0].style.overflow='{overflow_}'", scrolledElement_);
        }
        private Point CalcFrameLocationInScreenshot_(FrameChain frameChain, ScreenshotTypeEnum screenshotType)
        {
            EyesWebDriverTargetLocator switchTo = (EyesWebDriverTargetLocator)driver_.SwitchTo();
            FrameChain currentFC = frameChain.Clone();

            switchTo.DefaultContent();
            Point locationInScreenshot = Point.Empty;

            foreach (Frame frame in currentFC)
            {
                Rectangle          rect           = ((EyesRemoteWebElement)frame.Reference).GetClientBounds();
                SizeAndBorders     sizeAndBorders = ((EyesRemoteWebElement)frame.Reference).SizeAndBorders;
                RectangularMargins borders        = sizeAndBorders.Borders;
                rect.Offset(borders.Left, borders.Top);
                locationInScreenshot.Offset(rect.Location);
                switchTo.Frame(frame.Reference);
            }

            return(locationInScreenshot);
        }
示例#4
0
        private void PrepareParentFrames_()
        {
            if (originalFrameChain_.Count == 0)
            {
                return;
            }

            EyesWebDriverTargetLocator switchTo = (EyesWebDriverTargetLocator)driver_.SwitchTo();
            FrameChain fc = originalFrameChain_.Clone();

            while (fc.Count > 0)
            {
                switchTo.ParentFrame();
                Frame       currentFrame = fc.Pop();
                IWebElement rootElement  = EyesSeleniumUtils.GetCurrentFrameScrollRootElement(driver_, null);
                SaveCurrentFrameState_(frameStates_, driver_, rootElement);
                MaximizeTargetFrameInCurrentFrame_(currentFrame.Reference, rootElement);
            }
            frameStates_.Reverse();
            switchTo.Frames(originalFrameChain_);
        }