Skip to main content
Skip table of contents

Troubleshooting UI automation

Cannot Find Chrome Binary

Problem description

When trying to run a test case, you receive an error stating that Selenium cannot find the Chrome binary: 

CODE
org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary

Possible solution

This is likely due to the framework not finding the Chrome application in the expected location.

To point the framework to the location of the Chrome application in NexJ Studio:

  1. From the Window menu, select Preferences.
  2. In the Preferences dialog, navigate to the NexJ Studio > Launch Settings > Tool Settings page.
  3. Add the following argument in the Common VM arguments field:

JAVA
-Dnexj.uitest.chrome.binary="C:\\Java\\chrome-81.0-win32-x64\\chrome.exe"

For development, you should also add this argument to the Common VM arguments field on the NexJ Studio > Launch Settings > Scheme Console Settings page.

New browser session doesn't open

Problem description

You do not see a new browser session open after running (sim'login login pwd) even though it returns the following message in red: 

CODE
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:

  1. From the Window menu, select Preferences.
  2. In the Preferences dialog, navigate to the NexJ Studio > Launch Settings > Tool Settings page.
  3. Add the following argument in the Common VM arguments field:

JAVA
-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:

CODE
;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 have 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.

Debugging UI Test Failures

Capturing failure snapshots

You can set the tool to automatically capture a screenshot when a test fails.

To enable this functionality in NexJ Studio:

  1. From the Window menu, select Preferences.
  2. In the Preferences dialog, navigate to the NexJ Studio > Launch Settings > Tool Settings page.
  3. 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.

Keeping Application UI Open on Failure

The UI tests are designed to close the application window upon failure or success of the test case. This is handled by the finalizer in each test case file. You can force the UI to stay open after a failure by simply commenting out the quit command in the finalizer. 

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.