Troubleshooting UI automation
New browser session doesn't open
Problem description
I do not see a new browser session open after running (sim'login login pwd)
even though it returns the following message in red:
Starting ChromeDriver 2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb) on port 19701
Only local connections are allowed.
Possible solution
This is likely due to the browser running the UI test in headless mode.
To disable headless mode in NexJ Studio:
- From the Window menu, select Preferences.
- In the Preferences dialog, navigate to the NexJ Studio > Launch Settings > Tool Settings page.
Add the following argument in the Common VM arguments field:
-Dnexj.uitest.headless=false
For development, you should also add this argument to the Common VM arguments field on the NexJ Studio > Launch Settings > Scheme Console Settings page.
Timeout error
Problem description
My test keeps returning a timeout error similar to the following:
;Error: Timed out after 15 seconds waiting for nexj.core.testing.ui.application.AFLApplication$2@3ac62ca3
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:12:12'
System info: host: 'TOR-DT-JDOE', ip: '169.254.72.42', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.7.0_75'
Driver info: driver.version: unknown
at org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:259)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:228)
at nexj.core.testing.ui.application.AFLApplication.getWebElement(AFLApplication.java:116)
at nexj.core.testing.ui.application.AFLApplication.use(AFLApplication.java:166)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at nexj.core.scripting.JavaMethod.invoke(JavaMethod.java:255)
Possible solution
This can be caused by a variety of problems:
- You are trying to use a view path that does not exist on the current screen.
- You've asserted something that is in the view but should not be there.
- A
(sim'assertValue ... ...)
expression has failed. - A
(sim'waitUntil ... )
expression is unable to resolve to#t
.
In all cases, this failure should be investigated.
Capturing failure snapshots
You can set the tool to automatically capture a screenshot when a test fails.
To enable this functionality in NexJ Studio:
- From the Window menu, select Preferences.
- In the Preferences dialog, navigate to the NexJ Studio > Launch Settings > Tool Settings page.
Add the following arguments in the Common VM arguments field:
JAVA-Dnexj.uitest.screenshotsEnabled=true -Dnexj.uitest.screenshotDir="C:/java/automation"
For development, you should also add these arguments to the Common VM arguments field on the NexJ Studio > Launch Settings > Scheme Console Settings page.