Skip to content
Antônio "acdc" Jr edited this page Dec 17, 2017 · 7 revisions

seleniumQuery implements all relevant jQuery functions, as well as adds some of our own.

Our main goals is emulating user actions and "sensing" the pages, currently our intention is to implement functions that read the state of the page and allow intuitive form manipulation.

By following the principle above, supporting functions like .val() and .find() are among our priorities, whereas .addClass() and .attr('attributeName', 'attributeValue') are not.

Adding cross-driver/cross-browser support is among our highest priority goals and problems or differences found in between drivers are likely to be fixed first.

Every function in seleniumQuery is expected to produce the same outcome in any driver. If differences exist, the documentation will state them.

API

Global functions

  • $.url(); - returns the currently opened URL
  • $.url("http://www.example.com"); - orders the driver/browser to open http://www.example.com
  • $.url(new File("somewhere/index.html")); - orders the driver/browser to open file://.../somewhere/index.html
  • $.quit();
  • $.title();
  • $.eval("javascript code")
  • $.pause(<time>)
  • $.maximizeWindow()

Check the javadocs for our $.functions.

jQuery API and seleniumQuery Support

Below the current jQuery API and, when applicable, comments about their support (if any) under seleniumQuery.

  • .length - The number of elements in the jQuery object.
    • This functionality is available through the .size() function.
  • .selector - A selector representing selector passed to jQuery(), if any, when creating the original set.
    • This functionality is available through the .getBy() function and, as .selector was, depending on the context, is not always available.

Supported Functions

This is the list of functions currently supported by the seleniumQuery object.

  • .attr() - Get the value of an attribute for the first element in the set of matched elements or set one or more attributes for every matched element.
  • .children() - Get the children of each element in the set of matched elements, optionally filtered by a selector.
  • .click() - Click on an element.
  • .dblclick() - Double click on an element.
  • .each() - Iterate over a jQuery object, executing a function for each matched element.
  • .end() - End the most recent filtering operation in the current chain and return the set of matched elements to its previous state.
  • .eq() - Reduce the set of matched elements to the one at the specified index.
  • .filter() - Reduce the set of matched elements to those that match the selector or pass the function’s test.
  • .find() - Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.
  • .first() - Reduce the set of matched elements to the first in the set.
  • .focus() - Bind an event handler to the “focus” JavaScript event, or trigger that event on an element.
  • .get() - Retrieve the DOM elements matched by the jQuery object.
  • .hasClass() - Determine whether any of the matched elements are assigned the given class.
  • .html() - Get the HTML contents of the first element in the set of matched elements or set the HTML contents of every matched element.
  • .is() - Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.
  • jQuery() - Return a collection of matched elements either found in the DOM based on passed argument(s) or created by passing an HTML string.
  • .last() - Reduce the set of matched elements to the final one in the set.
  • .map() - Pass each element in the current matched set through a function, producing a new seleniumQuery object containing the return values.
  • .not() - Remove elements from the set of matched elements.
  • .parent() - Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
  • .prop() - Get the value of a property for the first element in the set of matched elements or set one or more properties for every matched element.
  • .removeAttr() - Remove an attribute from each element in the set of matched elements.
  • .size() - Return the number of elements in the jQuery object.
  • .submit() - Submits the form the element belongs to.
  • .text() - Get the combined text contents of each element in the set of matched elements, including their descendants, or set the text contents of the matched elements.
  • .toArray() - Retrieve all the elements contained in the jQuery set, as an array.
  • .val() - Get the current value of the first element in the set of matched elements or set the value of every matched element.

Usupported Functions

Functions listed here are yet to be evaluated if they will be added to seleniumQuery or not.

  • .add() - Add elements to the set of matched elements.
  • .addBack() - Add the previous set of elements on the stack to the current set, optionally filtered by a selector.
  • .andSelf() - Add the previous set of elements on the stack to the current set.
  • .closest() - For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
  • .contents() - Get the children of each element in the set of matched elements, including text and comment nodes.
  • .context - The DOM node context originally passed to jQuery(); if none was passed then context will likely be the document.
  • .css() - Get the value of a style property for the first element in the set of matched elements or set one or more CSS properties for every matched element.
  • .data() - Store arbitrary data associated with the matched elements or return the value at the named data store for the first element in the set of matched elements.
  • .focusin() - Bind an event handler to the “focusin” event.
  • .focusout() - Bind an event handler to the “focusout” JavaScript event.
  • .has() - Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.
  • .height() - Get the current computed height for the first element in the set of matched elements or set the height of every matched element.
  • .hover() - Bind one or two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.
  • .index() - Search for a given element from among the matched elements.
  • .innerHeight() - Get the current computed height for the first element in the set of matched elements, including padding but not border.
  • .innerWidth() - Get the current computed inner width (including padding but not border) for the first element in the set of matched elements or set the inner width of every matched element.
  • jQuery.contains() - Check to see if a DOM element is a descendant of another DOM element.
  • jQuery.globalEval() - Execute some JavaScript code globally.
  • .keydown() - Bind an event handler to the “keydown” JavaScript event, or trigger that event on an element.
  • .keypress() - Bind an event handler to the “keypress” JavaScript event, or trigger that event on an element.
  • .keyup() - Bind an event handler to the “keyup” JavaScript event, or trigger that event on an element.
  • .length - The number of elements in the jQuery object.
  • .mousedown() - Bind an event handler to the “mousedown” JavaScript event, or trigger that event on an element.
  • .mouseenter() - Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element.
  • .mouseleave() - Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element.
  • .mousemove() - Bind an event handler to the “mousemove” JavaScript event, or trigger that event on an element.
  • .mouseout() - Bind an event handler to the “mouseout” JavaScript event, or trigger that event on an element.
  • .mouseover() - Bind an event handler to the “mouseover” JavaScript event, or trigger that event on an element.
  • .mouseup() - Bind an event handler to the “mouseup” JavaScript event, or trigger that event on an element.
  • .next() - Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.
  • .nextAll() - Get all following siblings of each element in the set of matched elements, optionally filtered by a selector.
  • .nextUntil() - Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed.
  • .offset() - Get the current coordinates of the first element, or set the coordinates of every element, in the set of matched elements, relative to the document.
  • .offsetParent() - Get the closest ancestor element that is positioned.
  • .outerHeight() - Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns a number (without “px”) representation of the value or null if called on an empty set of elements.
  • .outerWidth() - Get the current computed width for the first element in the set of matched elements, including padding and border.
  • .parents() - Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector.
  • .parentsUntil() - Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object.
  • .position() - Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.
  • .prev() - Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector.
  • .prevAll() - Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector.
  • .prevUntil() - Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object.
  • .pushStack() - Add a collection of DOM elements onto the jQuery stack.
  • .queue() - Show or manipulate the queue of functions to be executed on the matched elements.
  • .resize() - Bind an event handler to the “resize” JavaScript event, or trigger that event on an element.
  • .scroll() - Bind an event handler to the “scroll” JavaScript event, or trigger that event on an element.
  • .scrollLeft() - Get the current horizontal position of the scroll bar for the first element in the set of matched elements or set the horizontal position of the scroll bar for every matched element.
  • .scrollTop() - Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element.
  • .select() - Bind an event handler to the “select” JavaScript event, or trigger that event on an element.
  • .siblings() - Get the siblings of each element in the set of matched elements, optionally filtered by a selector.
  • .slice() - Reduce the set of matched elements to a subset specified by a range of indices.
  • .trigger() - Execute all handlers and behaviors attached to the matched elements for the given event type.
  • .width() - Get the current computed width for the first element in the set of matched elements or set the width of every matched element.

Highly Unlikely

Many functions provide some very specific JavaScript programming tasks and do not represent typical user interactions with the page, that's why they are not implemented in seleniumQuery and probably will never be.

Functions that won't be implemented
  • .addClass() - Adds the specified class(es) to each of the set of matched elements.
  • .after() - Insert content, specified by the parameter, after each element in the set of matched elements.
  • .ajaxComplete() - Register a handler to be called when Ajax requests complete. This is an AjaxEvent.
  • .ajaxError() - Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event.
  • .ajaxSend() - Attach a function to be executed before an Ajax request is sent. This is an Ajax Event.
  • .ajaxStart() - Register a handler to be called when the first Ajax request begins. This is an Ajax Event.
  • .ajaxStop() - Register a handler to be called when all Ajax requests have completed. This is an Ajax Event.
  • .ajaxSuccess() - Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event.
  • .animate() - Perform a custom animation of a set of CSS properties.
  • .append() - Insert content, specified by the parameter, to the end of each element in the set of matched elements.
  • .appendTo() - Insert every element in the set of matched elements to the end of the target.
  • .bind() - Attach a handler to an event for the elements.
  • .blur() - Bind an event handler to the “blur” JavaScript event, or trigger that event on an element.
  • .before() - Insert content, specified by the parameter, before each element in the set of matched elements.
  • .change() - Bind an event handler to the “change” JavaScript event, or trigger that event on an element.
  • .clearQueue() - Remove from the queue all items that have not yet been run.
  • .clone() - Create a deep copy of the set of matched elements.
  • .delay() - Set a timer to delay execution of subsequent items in the queue.
  • .delegate() - Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.
  • .dequeue() - Execute the next function on the queue for the matched elements.
  • .detach() - Remove the set of matched elements from the DOM.
  • .die() - Remove event handlers previously attached using .live() from the elements.
  • .empty() - Remove all child nodes of the set of matched elements from the DOM.
  • .error() - Bind an event handler to the “error” JavaScript event.
  • .fadeIn() - Display the matched elements by fading them to opaque.
  • .fadeOut() - Hide the matched elements by fading them to transparent.
  • .fadeTo() - Adjust the opacity of the matched elements.
  • .fadeToggle() - Display or hide the matched elements by animating their opacity.
  • .finish() - Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements.
  • .hide() - Hide the matched elements.
  • .insertAfter() - Insert every element in the set of matched elements after the target.
  • .insertBefore() - Insert every element in the set of matched elements before the target.
  • .jquery - A string containing the jQuery version number.
  • jQuery.ajax() - Perform an asynchronous HTTP (Ajax) request.
  • jQuery.ajaxPrefilter() - Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().
  • jQuery.ajaxSetup() - Set default values for future Ajax requests. Its use is not recommended.
  • jQuery.ajaxTransport() - Creates an object that handles the actual transmission of Ajax data.
  • jQuery.boxModel - States if the current page, in the user’s browser, is being rendered using the W3C CSS Box Model. This property was removed in jQuery 1.8. Please try to use feature detection instead.
  • jQuery.browser - Contains flags for the useragent, read from navigator.userAgent. This property was removed in jQuery 1.9 and is available only through the jQuery.migrate plugin. Please try to use feature detection instead.
  • jQuery.cssHooks - Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties.
  • jQuery.data() - Store arbitrary data associated with the specified element and/or return the value that was set.
  • jQuery.dequeue() - Execute the next function on the queue for the matched element.
  • jQuery.each() - A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function’s arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.
  • jQuery.error() - Takes a string and throws an exception containing it.
  • jQuery.extend() - Merge the contents of two or more objects together into the first object.
  • jQuery.fn.extend() - Merge the contents of an object onto the jQuery prototype to provide new jQuery instance methods.
  • jQuery.fx.interval - The rate (in milliseconds) at which animations fire.
  • jQuery.fx.off - Globally disable all animations.
  • jQuery.get() - Load data from the server using a HTTP GET request.
  • jQuery.getJSON() - Load JSON-encoded data from the server using a GET HTTP request.
  • jQuery.getScript() - Load a JavaScript file from the server using a GET HTTP request, then execute it.
  • jQuery.grep() - Finds the elements of an array which satisfy a filter function. The original array is not affected.
  • jQuery.hasData() - Determine whether an element has any jQuery data associated with it.
  • jQuery.holdReady() - Holds or releases the execution of jQuery’s ready event.
  • jQuery.inArray() - Search for a specified value within an array and return its index (or -1 if not found).
  • jQuery.isArray() - Determine whether the argument is an array.
  • jQuery.isEmptyObject() - Check to see if an object is empty (contains no enumerable properties).
  • jQuery.isFunction() - Determine if the argument passed is a Javascript function object.
  • jQuery.isNumeric() - Determines whether its argument is a number.
  • jQuery.isPlainObject() - Check to see if an object is a plain object (created using “{}” or “new Object”).
  • jQuery.isWindow() - Determine whether the argument is a window.
  • jQuery.isXMLDoc() - Check to see if a DOM node is within an XML document (or is an XML document).
  • jQuery.makeArray() - Convert an array-like object into a true JavaScript array.
  • jQuery.map() - Translate all items in an array or object to new array of items.
  • jQuery.merge() - Merge the contents of two arrays together into the first array.
  • jQuery.noConflict() - Relinquish jQuery’s control of the $ variable.
  • jQuery.noop() - An empty function.
  • jQuery.now() - Return a number representing the current time.
  • jQuery.param() - Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request.
  • jQuery.parseHTML() - Parses a string into an array of DOM nodes.
  • jQuery.parseJSON() - Takes a well-formed JSON string and returns the resulting JavaScript object.
  • jQuery.parseXML() - Parses a string into an XML document.
  • jQuery.post() - Load data from the server using a HTTP POST request.
  • jQuery.proxy() - Takes a function and returns a new one that will always have a particular context.
  • jQuery.queue() - Show or manipulate the queue of functions to be executed on the matched element.
  • jQuery.removeData() - Remove a previously-stored piece of data.
  • jQuery.sub() - Creates a new copy of jQuery whose properties and methods can be modified without affecting the original jQuery object.
  • jQuery.support - A collection of properties that represent the presence of different browser features or bugs. Intended for jQuery’s internal use; specific properties may be removed when they are no longer needed internally to improve page startup performance. For your own project’s feature-detection needs, we strongly recommend the use of an external library such as Modernizr instead of dependency on properties in jQuery.support.
  • jQuery.trim() - Remove the whitespace from the beginning and end of a string.
  • jQuery.type() - Determine the internal JavaScript Class of an object.
  • jQuery.unique() - Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.
  • jQuery.when() - Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
  • .live() - Attach an event handler for all elements which match the current selector, now and in the future.
  • .load() - Load data from the server and place the returned HTML into the matched element.
  • .load() - Bind an event handler to the “load” JavaScript event.
  • .off() - Remove an event handler.
  • .on() - Attach an event handler function for one or more events to the selected elements.
  • .one() - Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
  • .prepend() - Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
  • .prependTo() - Insert every element in the set of matched elements to the beginning of the target.
  • .promise() - Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished.
  • .ready() - Specify a function to execute when the DOM is fully loaded.
  • .remove() - Remove the set of matched elements from the DOM.
  • .removeClass() - Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
  • .removeData() - Remove a previously-stored piece of data.
  • .removeProp() - Remove a property for the set of matched elements.
  • .replaceAll() - Replace each target element with the set of matched elements.
  • .replaceWith() - Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed.
  • .serialize() - Encode a set of form elements as a string for submission.
  • .serializeArray() - Encode a set of form elements as an array of names and values.
  • .show() - Display the matched elements.
  • .slideDown() - Display the matched elements with a sliding motion.
  • .slideToggle() - Display or hide the matched elements with a sliding motion.
  • .slideUp() - Hide the matched elements with a sliding motion.
  • .stop() - Stop the currently-running animation on the matched elements.
  • .toggleClass() - Add or remove one or more classes from each element in the set of matched elements, depending on either the class’s presence or the value of the switch argument.
  • .toggle() - Display or hide the matched elements.
  • .toggle() - Bind two or more handlers to the matched elements, to be executed on alternate clicks.
  • .triggerHandler() - Execute all handlers attached to an element for an event.
  • .unbind() - Remove a previously-attached event handler from the elements.
  • .undelegate() - Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.
  • .unload() - Bind an event handler to the “unload” JavaScript event.
  • .unwrap() - Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.
  • .wrap() - Wrap an HTML structure around each element in the set of matched elements.
  • .wrapAll() - Wrap an HTML structure around all elements in the set of matched elements.
  • .wrapInner() - Wrap an HTML structure around the content of each element in the set of matched elements.
  • Callbacks Object: The Callbacks object consists in a utility object to manage callback lists. It is aimed to support JavaScript development, thus not relevant to seleniumQuery. --- jQuery.Callbacks(), callbacks.add(), callbacks.disable(), callbacks.disabled(), callbacks.empty(), callbacks.fire(), callbacks.fired(), callbacks.fireWith(), callbacks.has(), callbacks.lock(), callbacks.locked(), callbacks.remove().
  • Event Object: In seleniumQuery we inspect events effects from the user perspective i.e. from their visible effects on the page. We do not handle events directly, thus making the event object not relevant. --- event.currentTarget, event.data, event.delegateTarget, event.isDefaultPrevented(), event.isImmediatePropagationStopped(), event.isPropagationStopped(), event.metaKey, event.namespace, event.pageX, event.pageY, event.preventDefault(), event.relatedTarget, event.result, event.stopImmediatePropagation(), event.stopPropagation(), event.target, event.timeStamp, event.type, event.which.
  • Deferred Object: The Deferred object, is a utility object intended to support JavaScript development, not applicable to seleniumQuery. --- jQuery.Deferred(), deferred.always(), deferred.done(), deferred.fail(), deferred.isRejected(), deferred.isResolved(), deferred.notify(), deferred.notifyWith(), deferred.pipe(), deferred.progress(), deferred.promise(), deferred.reject(), deferred.rejectWith(), deferred.resolve(), deferred.resolveWith(), deferred.state(), deferred.then().