Using jQuery selectors
jQuery selectors are important features of the jQuery library. jQuery selectors are based on CSS1-3 selectors along with some additional selectors. These selectors use the familiar CSS Selector syntax to allow developers to quickly and easily identify page elements to operate using the jQuery library methods. Similar to CSS selectors, these selectors allow us to find and manipulate HTML elements as a single element or list of elements.
jQuery selectors can be used where CSS selectors are not supported natively by the browsers.
In this recipe, we will explore in brief how to use jQuery selectors with Selenium WebDriver.
How to do it...
Let's create a test that checks that specified checkboxes are selected when a page is displayed, as follows:
@Test public void testDefaultSelectedCheckbox() { // Expected list of selected Checkbox List<String> checked = Arrays .asList("user128_admin", "user220_browser"); // Create an instance of JavaScript Executor...