internal void TryHideScrollbars(bool stitchContent, IWebElement scrollRootElement) { if (configuration_.HideScrollbars) { scrollRootElement_ = scrollRootElement; frameChain_ = driver_.GetFrameChain().Clone(); if (frameChain_.Count > 0) { FrameChain fc = frameChain_.Clone(); // for the target frame, we only wish to remove scrollbars when in "fully" mode. if (stitchContent) { Frame frame = fc.Peek(); frame.HideScrollbars(driver_); } RemoveScrollbarsFromParentFrames_(logger_, fc, driver_); } else { logger_.Verbose("hiding scrollbars of element: {0}", scrollRootElement); originalOverflow_ = EyesSeleniumUtils.SetOverflow("hidden", driver_, scrollRootElement); } logger_.Verbose("switching back to original frame"); ((EyesWebDriverTargetLocator)driver_.SwitchTo()).Frames(frameChain_); logger_.Verbose("done hiding scrollbars."); } else { logger_.Verbose("no need to hide scrollbars."); } }
private static void RemoveScrollbarsFromParentFrames_(Logger logger, FrameChain fc, EyesWebDriver driver) { logger.Verbose("enter"); driver.SwitchTo().ParentFrame(); fc.Pop(); Frame frame = fc.Peek(); while (fc.Count > 0) { logger.Verbose("fc.Count = {0}", fc.Count); frame.HideScrollbars(driver); driver.SwitchTo().ParentFrame(); fc.Pop(); frame = fc.Peek(); } logger.Verbose("exit"); }