Hi,
I tried the below code, it is working fine as expected
WebUI.executeJavaScript(‘grid.scrollRowIntoView(0,false);’, );
WebElement dom = WebUI.executeJavaScript(‘return grid.getCellNode(0,0);’, );
println(dom.getText());
When I try to loop over on the above code as
for (int i = 0; i<rowCount; i++) {
WebUI.executeJavaScript(‘grid.scrollRowIntoView(i,false);’, );
WebElement dom = WebUI.executeJavaScript(‘return grid.getCellNode(i,0);’, );
println(dom.getText());
}
I am getting null point exception.
Can anyone please help me in this regard.
Any help would be much appreciated.
Thanks,
Sampath.
Rahul
2
Hi
put your code in try catch block and see for what value of i it is throwing NPE
try{
for (int i = 0; i<rowCount; i++) {
WebUI.executeJavaScript(‘grid.scrollRowIntoView(i,false);’, []);
WebElement dom = WebUI.executeJavaScript(‘return grid.getCellNode(i,0);’, []);
println(dom.getText());
}catch(Exception e){
}
My guess is that, for a value of i following statement is returning null
WebElement dom = WebUI.executeJavaScript(‘return grid.getCellNode(i,0);’, []);
here dom might be nulll
and that’s why dom.getText() is throwing NPE
1 Like
Hi Rahul,
Thanks for the reply, I was able to sort out the issue by replacing i with ‘+i+’ in my code.
Regards,
Sampath
1 Like