Unable to Scroll in Kendo Grid

186 views
Skip to first unread message

Sonia saini

unread,
Jul 8, 2015, 12:16:57 PM7/8/15
to seleniu...@googlegroups.com
Hi,

I am facing problem to scroll on kendo grid.

I 've requirement to scroll kendo grid content to make visible element in selenium so that my test case should pass but due to scroll bar not appeared I get exception element not visible.

In kendo grid we have many columns in table header where I need to validate text for that. Let say if 8 columns are visible selenium can identify but remanning can not while my css gives me all elements.

CSS for locater  when I use it in developer tool I get all columns text.
(" #analysis-variants-grid thead span[class][data-original-title]")

When I had a word with developer they say it is Kendo default behaviour scroll bar comes if required but they have not written code for scroll bar.
 It is not window to scroll it is kendo table ,which I want to scroll.

I've used below options to over come.

1.Java executer:
JavascriptExecutor js=((JavascriptExecutor) getWebDriver());
WebElement scroll= getWebDriver().findElement(By.cssSelector(".k-grid-content"));
moveTo(KENDO_CONTENT);
js.executeScript("arguments[0].scrollIntoView();", scroll);
2.
JavascriptExecutor js=((JavascriptExecutor) getWebDriver());
WebElement scroll= getWebDriver().findElement(By.cssSelector(".k-grid-content"));
while(!scroll.isDisplayed()){
String blockHeight = "return arguments[0].offsetHeight";

String myscript = "arguments[0].scrollTop"+js.executeScript(blockHeight,scroll);
js.executeScript("arugments[0].scrollLeft(500);",scroll);
js.executeScript( scroll);
  3.
Actions action = new Actions(getWebDriver());
waitForPresence(KENDO_CONTENT);
action.sendKeys(Keys.LEFT).perform();
action.sendKeys(Keys.LEFT).perform();
but it did not move to left. when we mouse hover on kendo grid content that time we can see scroll bar.

I really appreciate your help and time. 


Screen Shot 2015-07-08 at 12.40.54 pm.png

Shawn Knight

unread,
Jul 11, 2015, 10:09:08 PM7/11/15
to seleniu...@googlegroups.com
Have you tried using the Actions class? 

Sonia saini

unread,
Jul 12, 2015, 11:48:09 AM7/12/15
to seleniu...@googlegroups.com
Yes, You see in my code I have put Action work around too.

On Sun, Jul 12, 2015 at 7:39 AM, Shawn Knight <shawn.kn...@gmail.com> wrote:
Have you tried using the Actions class? 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/22438d7f-df60-48b1-8345-015cec35d5d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Sonia saini

Shawn Knight

unread,
Jul 12, 2015, 9:47:45 PM7/12/15
to seleniu...@googlegroups.com
I apologize, I guess I skipped over that -- however, have you tried this? -- new Actions(driver).moveToElement(WebElement).perform();

Reply all
Reply to author
Forward
0 new messages