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 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"))); }