npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

auquery

v0.2.4

Published

Selenium-powered JQuery-like automation library

Downloads

20

Readme

Build Status

#auQuery# jQuery-like browser automation library.

##Why auQuery?## auQuery offer several advantages over other browser automation tools that works with selenium:

  1. auQuery syntax is synchronous. This is easier to model for procedural code like automation, plus Selenium is synchronous, and cannot handle several request at the same time. auQuery also plays nice with existing asynchronous interfaces.

  2. auQuery syntax is similar to jQuery. JQuery is a familiar web syntax, and that knowledges and even libraries can be reused on auQuery

  3. auQuery wraps the wd interface. Internally, auQuery uses wd to access the browsers, it also exposes all of wd methods syncrhonously for easy consumption. On the drive method the second parameter is a browser method.

  4. auQuery allows page object. Selenium Webdriver includes a way to develop based on page object. AuQuery supports a similar methodology to maintain large projects using coffee.

###Example### Google search example:

var lib = require('auQuery');
var wd = require('wd'); 
var assert = require('assert'); 
var Browser = lib.browser; 
var AuQuery = lib.auQuery; 

var webDriver = wd.remote(); 

var browser = new Browser(webDriver); 

browser.drive(function($, browser){
  browser.init(); 
	browser.get('http://www.google.com'); 
	$('input[name=q]').type('Hello World'); 
	console.log( browser.title() ); 
	browser.quit();
}
, function(err, res){
	if(err){
		console.log(err); 
	}
});

##Installation##

  1. Install node.js
  2. run npm install auQuery
  3. auQuery, can run against Selenium, Selenium Grid or SauceLabs. See wd configuration for usage.

##auQuery Methods##

###Query### Supported JQuery-like Methods:

On auQuery:

  • extend - extends the auQuery or auQuery.fn (prototype) object
  • each - iterates through an array like object

On elements:

  • css - get computed css property
  • attr - brings the first value of selected items
  • val - brings the value attribute
  • text - brings the inner text
  • tag - the tag for the first element
  • classes - an array with the css classes for the first element
  • hasClass - boolean if the first element has a particular class
  • is - if the element has a particular tag
  • find -find descendant elements to the auQuery object through a css Selector
  • each - iterates through each element
  • slice - similar to array slice
  • eq - select a single element in the position
  • first
  • last
  • get
  • size
  • toArray
  • each
  • push
  • sort
  • splice
  • end
  • merge
  • pushStack

###Actions###

Selenium Related methods:

  • type - write a text into each element selected (alias:sendKeys)
  • clear - clear a input area
  • click - click on the first item of the navigator

###Alias###

  • sendKeys - Aliases type
  • getAttribute - aliases attr
  • getValue - aliases val
  • head - aliases first
  • tail - aliases last
  • $ - aliases auQuery

###Page Objects### Page objects allow you to better manage large projects. PageObjects work by modifying the prototype of the currently running object so that the methods become available. The current page object can be changed using the page() method and passing the constructor of the class. However a common thing to do is clicking and changing page PageObject.button allow you to define this process. Po.Elements allow you to bring elements jit for a selector.

Example on Coffee Script of Page Objects:

lib = require 'auQuery' 
wd = require 'wd' 
Browser = lib.browser
po = lib.pageObject

class googleResults
  links: ->(link.text() for link in @$('.r a'))

class google 
	searchButton:  po.button(selector:'button[name=btnG]', page:googleResults)
	q: po.elements('input[name=q]')
google.to = 'http://www.google.com'

webDriver = wd.remote()
browser = new Browser(webDriver)

browser.drive(
	($, browser)->
		browser.init()
		@to google
		@type q:'auQuery'
		@wait 3000
		@click 'searchButton'
		@wait 1000
		links = @links()
		browser.quit()
		links
	(err, res)->
		console.log(err);
		console.log(res); 
)

###Limits###

  • This library is not feature-complete compared with Selenium Webdriver.
  • This library does not implement (or plan to implement) all of jQuery features.
  • This library depends on fibers, and is not portable to run on the browser (node.js only)

###LICENSE###

  • MIT