Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected token #22

Closed
jazonmiller opened this issue Dec 18, 2018 · 3 comments
Closed

Unexpected token #22

jazonmiller opened this issue Dec 18, 2018 · 3 comments

Comments

@jazonmiller
Copy link

I'm running into an issue when attempting to use axe 2.1 with my selenium tests. I've borrowed the code from the SetupTest.java class. Any suggestions or examples you could share?

Code Snip:

public class AccessibilityHandler {

private static final URL scriptUrl = AccessibilityHandler.class.getResource("/axe.min.js");
private static final Logger LOGGER = LoggerFactory.getLogger(AccessibilityHandler.class);

public static void testAccessibility(WebDriver driver) {
JSONObject responseJSON;
try {
responseJSON = new AXE.Builder(driver, scriptUrl).analyze();
JSONArray violations = responseJSON.getJSONArray("violations");
if (violations.length() == 0) {
assertTrue("No violations found", true);
} else {
AXE.writeResults("Test Method", responseJSON);
}
} catch (Exception e) {
LOGGER.error("*****************an error occurred with analyze", e);
}
}
}

### Sanitized Error log:
org.openqa.selenium.WebDriverException: unknown error: Runtime.evaluate threw exception: SyntaxError: Unexpected token <
(Session info: chrome=65.0.3325.146)
(Driver info: chromedriver=2.38.552518 (183d19265345f54ce39cbb94cf81ba5f15905011),platform=Mac OS X 10.13.4 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: XXXXXXXXXXXXX, os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.4', java.version: '1.8.0_171'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.38.552518 (183d19265345f5..., userDataDir: /var/folders/w9/xgvfht4s1xd...}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: MAC, platformName: MAC, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 65.0.3325.146, webStorageEnabled: true}
Session ID: 762e154cbaa0f081ad27d49fa135b891
at sun.reflect.GeneratedConstructorAccessor15.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:485)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.openqa.selenium.support.events.EventFiringWebDriver.lambda$new$1(EventFiringWebDriver.java:105)
at com.sun.proxy.$Proxy11.executeScript(Unknown Source)
at com.deque.axe.AXE.inject(AXE.java:79)
at com.deque.axe.AXE$Builder.execute(AXE.java:322)
at com.deque.axe.AXE$Builder.analyze(AXE.java:307)

@ghidalgo
Copy link

ghidalgo commented Jan 22, 2019

ran into this same issue. Mine seems to be throwing the error at

builder.analyze();

@stephenmathieson
Copy link
Member

Can you please provide more details? I'm not able to reproduce your issue.

@stephenmathieson
Copy link
Member

Closing for now. If you're still experiencing this problem, please feel free reopen with reproduction steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants