Scroll Down action Works as expected, but throw an error in ATS

0
Hi Guys,      Last few days our scripts fails because of scroll down issue.We have passed several regressions without any issue in Scroll down action.Now we facing this issue,when we use scroll action we can see that scroll operation works fine in browser stack and failed in ats and through these errors Error Log: at 16: [Scroll down to element]:   with Widget: [[RemoteWebDriver: chrome on XP (870f59e118abd05d3e7ed9760d9a0a1d7bdfad82)] -> css selector: [data-mendix-id="162_4_19"] .row]  with Slow scroll: true Scroll down to element:   at 1: slow scroll:   with Script: TEXT: function getScrollParent(element, includeHidden) {     var style = getComputedStyle(element);     var excludeStaticParent = style.position === "absolute";     var overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/;     if (style.position === "fixed") return document.body;     for (var parent = element; (parent = parent.parentElement);) {         style = getComputedStyle(parent);         if (excludeStaticParent && style.position === "static") {             continue;         }         if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX)) return parent;     }     return document.body; } X = getScrollParent(arguments[0]);   X1 = X.scrollHeight; X2 = $(X);  X3 = X2.animate({                     scrollTop: $(arguments[0]).offset().top                 }, 2000);  with Argument0: ANY: [[RemoteWebDriver: chrome on XP (870f59e118abd05d3e7ed9760d9a0a1d7bdfad82)] -> css selector: [data-mendix-id="162_4_19"] .row] Execute Javascript String Caused by: com.mansystems.ATS.Runner.exceptions.RunnerException:   at com.mansystems.ATS.Runner.definitions.functions.FunctionImpl.run(FunctionImpl.java:62)  at com.mansystems.ATS.Runner.definitions.functions.FunctionImpl$1.run(FunctionImpl.java:36)  at com.mansystems.ATS.Runner.execution.ExecutionContextRoutine.execute(ExecutionContextRoutine.java:172)  at com.mansystems.ATS.Runner.execution.ExecutionContextTestStep.execute(ExecutionContextTestStep.java:140)  at com.mansystems.ATS.Runner.execution.ExecutionContextActionComposition.run(ExecutionContextActionComposition.java:41)  at com.mansystems.ATS.Runner.execution.ExecutionContextRoutine.execute(ExecutionContextRoutine.java:172)  at com.mansystems.ATS.Runner.execution.ExecutionContextTestStep.execute(ExecutionContextTestStep.java:140)  at com.mansystems.ATS.Runner.execution.ExecutionContextTestCase.executeTestSteps(ExecutionContextTestCase.java:153)  at com.mansystems.ATS.Runner.execution.ExecutionContextTestCase.run(ExecutionContextTestCase.java:121)  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)  at java.util.concurrent.FutureTask.run(FutureTask.java:266)  at com.mansystems.ATS.Runner.execution.ExtendedFuture.run(ExtendedFuture.java:69)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)  at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.reflect.InvocationTargetException  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  at java.lang.reflect.Method.invoke(Method.java:498)  at com.mansystems.ATS.Runner.definitions.functions.FunctionReflectionHelper.invokeRunInternalMethod(FunctionReflectionHelper.java:29)  at com.mansystems.ATS.Runner.definitions.functions.FunctionImpl.run(FunctionImpl.java:59)  ... 14 more Caused by: java.lang.NullPointerException Tried these Ways: 1)We 1st Assert the Element and call scroll action to scroll upto the element. 2)Getting css of the Element and call Scroll action.
asked
8 answers
2

Hey Shanmuga Sugash,

Was this the first time you ran those tests on ATS2.5? We have fixed an item in ATS2.5 that you now need to add a return statement everytime you use a JavaScript action, with this action you would need to return a String. ATS2.4 did not check for this, but for JavaScript code it is better to do check for this. So at the end of your code you would need something like: return ""; 

Could you please tell me if this helps? If not we can look further at what the problem migth be.

Kind regards,

Myrthe

answered
0

We Use Return statement for actions which needed.For this Issue we used return statement for "Find/Assert Widget" action i added the screenshot for 9th and 10th step.i think it will help you to figure out.
I can see the Scroll down operation which is working as excepted in Browserstack and in ATS its fails and throws Error

answered
0

Hey Myrthe Walhout,We again tried this action "Scroll down to element" and observed the same issue exists. No problem with scrolldown operation but it throws an error in ATS results log file . Please let me know other way to work around this and also we got an custom action scroll down xml file,let me know how to use the xml file in existing action. please guide us on this

Error Log:
Testing purpose: 
	at 10: [Scroll down to element]: 
	with Widget: [org.openqa.selenium.remote.RemoteWebElement@37 -> unknown locator]

Scroll down to element: 
	at 2: Fast scroll: 
	with Script: TEXT: function getScrollParent(element, includeHidden) {
    var style = getComputedStyle(element);
    var excludeStaticParent = style.position === "absolute";
    var overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/;

    if (style.position === "fixed") return document.body;
    for (var parent = element; (parent = parent.parentElement);) {
        style = getComputedStyle(parent);
        if (excludeStaticParent && style.position === "static") {
            continue;
        }
        if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX)) return parent;
    }

    return document.body;
}
X = getScrollParent(arguments[0]);
 
X1 = X.scrollHeight;

X2 = $(X); 

X3 = X2.animate({
                    scrollTop: $(arguments[0]).offset().top
                }, 20);
	with Argument0: ANY: [org.openqa.selenium.remote.RemoteWebElement@37 -> unknown locator]

Execute Javascript String
Caused by: com.mansystems.ATS.Runner.exceptions.RunnerException: 
	at com.mansystems.ATS.Runner.definitions.functions.FunctionImpl.run(FunctionImpl.java:62)
	at com.mansystems.ATS.Runner.definitions.functions.FunctionImpl$1.run(FunctionImpl.java:36)
	at com.mansystems.ATS.Runner.execution.ExecutionContextRoutine.execute(ExecutionContextRoutine.java:172)
	at com.mansystems.ATS.Runner.execution.ExecutionContextTestStep.execute(ExecutionContextTestStep.java:140)
	at com.mansystems.ATS.Runner.execution.ExecutionContextActionComposition.run(ExecutionContextActionComposition.java:41)
	at com.mansystems.ATS.Runner.execution.ExecutionContextRoutine.execute(ExecutionContextRoutine.java:172)
	at com.mansystems.ATS.Runner.execution.ExecutionContextTestStep.execute(ExecutionContextTestStep.java:140)
	at com.mansystems.ATS.Runner.execution.ExecutionContextTestCase.executeTestSteps(ExecutionContextTestCase.java:153)
	at com.mansystems.ATS.Runner.execution.ExecutionContextTestCase.run(ExecutionContextTestCase.java:121)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at com.mansystems.ATS.Runner.execution.ExtendedFuture.run(ExtendedFuture.java:69)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.GeneratedMethodAccessor200.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.mansystems.ATS.Runner.definitions.functions.FunctionReflectionHelper.invokeRunInternalMethod(FunctionReflectionHelper.java:29)
	at com.mansystems.ATS.Runner.definitions.functions.FunctionImpl.run(FunctionImpl.java:59)
	... 14 more
Caused by: java.lang.NullPointerException
answered
0

Hey Suresh,

The xml file that I send to you should be imported into your ATS project you can do that as follows:

1. Open your project in ATS

2. Go to the menu item Test Cases and to the tab Repository

3. Click on the Actions dropdown and then on Import

4. Click import from file and select the xml file that I have send you. 

5. Click Upload and then Import

Then you should use that custom action in your test cases instead of the old 'scroll down to element' custom action.

Please run your test case with the new 'Scroll down to element' test case. Does your test case work now?

Kind regards,

Myrthe Walhout

answered
0

We have navigated as per your steps but the file "Scroll down to element(v2).xml" was not uploaded instead received an error message as " Keyword update denied".

answered
0

I am sorry, I forgot to delete something. Could you try it again?

answered
0

Thanks Mytrthe and now the scroll down action is working fine without any error in logs

answered
0

That is great to hear! :)

answered