How to wait until page freezes in Selenium WebDriver?

We have got following logic on frontend - so when new page is loaded, screen is auto scrolling to specific section and I have a script which clicks on the specific element at that time. Hence, while this movement is occurring following error is appearing due to the fact that selenium is clicking on wrong element:

"Element is not clickable at point (x, y). Other element would receive the click..."

I have added plain sleep, but this solution is not a good one. So does any one know how to wait until page freezes - when auto scrolling is finished?


f you know what element you're scrolling to (the element that is at the top of browser viewport when you're done with scrolling) you can wait for the y property of a navigator representing that element to equal zero. Following is an example that you can paste into groovy console which goes to a page and then scrolls to an element by using it's id in the url (I know there is no waiting here nor the scrolling is animated but I just want to show how that property can be used to achieve want you want): I am not familiar with protractor, so you will have to adjust the block syntax appropriately.

waitFor { 
  elementWeScrollTo.y == 0 
}
链接地址: http://www.djcxy.com/p/44866.html

上一篇: Selenium的异步显示区域加载

下一篇: 如何等到Selenium WebDriver页面冻结?