jQuery selectors for CodedUI

I have created a nuget package that helps you select elements from a page using jquery selectors. Its called CodedUI.jQueryExtensions.

It currently adds 4 methods to the BrowserWindow object.

IEnumerable JQuerySelect(this BrowserWindow window, string selector)

bool JQueryExists(this BrowserWindow window, string selector)

bool JQueryWaitForExists(this BrowserWindow window, string selector)

bool JQueryWaitForExists(this BrowserWindow window, string selector, int timeoutMilliSec)

Selecting li’s from a ul with and id is as simple as this:

Browser.JQuerySelect<HtmlControl>("#multipleElementsTest li");

If the selector did not return any results then an empty enumerable will be returned.

Checking to see if an element exists is now trivial:

return Browser.JQueryExists("#div1");

Waiting for an element to exits (perhaps a dialog to open?):

return Browser.JQueryWaitForExists("#modalDialog");

But what if I don’t have jQuery on the page I am testing

CodedUI.jQueryExtensions will automatically include a reference to jQuery on the page if one does not already exist. When the package is installed it adds a appSetting to the app.config file that contains the URL of the jQuery that will be referenced. By default it uses ‘//code.jquery.com/jquery-latest.min.js’

How do i install it?

PM> Install-Package CodedUI.jQueryExtensions

Check out the project page
https://github.com/rpearsondev/CodedUI.jQueryExtensions

Check out the nuget page
https://www.nuget.org/packages/CodedUI.jQueryExtensions/”