public bool ScrollReset(IUIControl scrollable = null) { scrollable = scrollable ?? this; scrollable.ExecuteScript("arguments[0].scrollTo(0, 0)"); int origiScrollLeft = Int32.Parse(scrollable.GetProperty("scrollLeft")); int originScrollTop = Int32.Parse(scrollable.GetProperty("scrollTop")); Thread.Sleep(100); return(originScrollTop == 0 && originScrollTop == 0); }
public bool ScrollVertical(int?pixelToScroll = null, IUIControl scrollable = null) { scrollable = scrollable ?? this; int originScrollTop = Int32.Parse(scrollable.GetProperty("scrollTop")); int scrollHeight = Int32.Parse(scrollable.GetProperty("scrollHeight")); int clientHeight = Int32.Parse(scrollable.GetProperty("clientHeight")); if (pixelToScroll == null) { if (clientHeight >= scrollHeight) { return(false); } pixelToScroll = clientHeight; } else if (pixelToScroll == 0) //Special case to scroll back to 0 { pixelToScroll = -originScrollTop; } ExecuteScript("arguments[0].scrollTo(0, arguments[1])", pixelToScroll + originScrollTop); Executor.Until(() => originScrollTop != Int32.Parse(scrollable.GetProperty("scrollTop")), 1000); return(originScrollTop != Int32.Parse(scrollable.GetProperty("scrollTop"))); }
public bool ScrollHorizontal(int?pixelToScroll = null, IUIControl scrollable = null) { scrollable = scrollable ?? this; int origiScrollLeft = Int32.Parse(scrollable.GetProperty("scrollLeft")); int scrollWidth = Int32.Parse(scrollable.GetProperty("scrollWidth")); int clientWidth = Int32.Parse(scrollable.GetProperty("clientWidth")); if (pixelToScroll == null) { if (clientWidth >= scrollWidth) { return(false); } pixelToScroll = clientWidth; } else if (pixelToScroll == 0) //Special case to scroll back to 0 { pixelToScroll = -origiScrollLeft; } scrollable.ExecuteScript("arguments[0].scrollTo(arguments[1], 0)", pixelToScroll + origiScrollLeft); Executor.Until(() => origiScrollLeft != Int32.Parse(scrollable.GetProperty("scrollLeft")), 1000); return(origiScrollLeft != Int32.Parse(scrollable.GetProperty("scrollLeft"))); }