JQuery Cheatsheet

JQuery selectors are used to automate logins with the Browser Credential resources. 

Use this cheat-sheet to identify elements on the page.

 

Identifying Inputs (username / password)

Does the element have a unique id like:

    <input id="someid">

If so to identify the element in the Browser Credential resource use:

    #someid

 

Next if there is no id, look for a name:

    <input name="somename" >

If the name is unique in the page you can use:

     input[name='somename']

 

Identifying Actions (Login button)

Actions are typically buttons but could be links as well. Use the same method as above they will typically have an id or a name.

Links using the <a> tag might not have a name of an id. You can identify this uniquely if it has a URL in the href attribute

     <a href="login_submit.html">

So would use

     a[href='login_submit.html']

You can also identify elements by their class, these tend not to be unique. For example 

    <a class="logon">

If there is only one use of logon class in the page you can use:

     .logon

Or if the use of class is unique to the tag you can use

     a.logon

 

Identifying Errors and Matches

When you match a URL you may also need to specify additional match selectors, especially if the page is not a dedicated logon page. Errors need to be captured so that the logon page does not go into an infinite loop of submitting the credentials. So capturing changes on the page is essential

In addition to the above strategies you can also look for specific text in an element

     <div>This is a logon form</div>

To select this you can use

     div:contains('This is a logon form')

 

 

Have more questions? Submit a request

Comments