2

I work with automated front-end testing using Selenium webdriver quite frequently. One webdriver method I need to use a lot is webDriver.executeScript("some jQuery stuff usually").

My problem is that using this method is pretty difficult: no autocomplete, multiple statements are hard, embedded strings become messy fast, etc. So much like it's nice to have a jQuery class in Javascript, it would be nice to have a jQuery class in Java.

I know there are several existing pieces of software which wrap popular existing libraries like jQuery and Underscore.js, but I don't know of a generic library which converts Javascript classes to Java classes.

I created a pretty basic implementation to demonstrate what I'm looking for. It works pretty easily because JS lets you inspect all the functions of a class, all the functions of its prototype, and AngularJS's method for annotating functions is publicly available.

For example, running JS2J.generate("$") will create this Java class.

I have searched for "javascript to java class converter", but I couldn't find any library which does what I want, which is generate a Java class from a Javascript class.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.