{"id":21353359,"url":"https://github.com/marketionist/protractor-numerator","last_synced_at":"2025-07-12T21:31:41.667Z","repository":{"id":48070618,"uuid":"77732281","full_name":"Marketionist/protractor-numerator","owner":"Marketionist","description":"This module adds readable numeration for elements in Protractor end-to-end testing framework","archived":false,"fork":false,"pushed_at":"2021-08-09T04:27:41.000Z","size":51,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-07T11:19:11.885Z","etag":null,"topics":["e2e-tests","elements-numeration-functions","end-to-end","javascript","protractor","protractor-numerator","protractor-tests","selenium"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Marketionist.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-31T08:35:23.000Z","updated_at":"2021-08-09T04:27:40.000Z","dependencies_parsed_at":"2022-08-12T18:00:27.686Z","dependency_job_id":null,"html_url":"https://github.com/Marketionist/protractor-numerator","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marketionist%2Fprotractor-numerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marketionist%2Fprotractor-numerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marketionist%2Fprotractor-numerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marketionist%2Fprotractor-numerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Marketionist","download_url":"https://codeload.github.com/Marketionist/protractor-numerator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225834508,"owners_count":17531511,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["e2e-tests","elements-numeration-functions","end-to-end","javascript","protractor","protractor-numerator","protractor-tests","selenium"],"created_at":"2024-11-22T03:17:20.932Z","updated_at":"2024-11-22T03:17:21.562Z","avatar_url":"https://github.com/Marketionist.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# protractor-numerator\n\n[![No Maintenance Intended](http://unmaintained.tech/badge.svg)](http://unmaintained.tech/)\n\n# This package is deprecated and will not be updated anymore as the Angular team announced that Protractor will be sunsetted at the end of 2022 - https://github.com/angular/protractor/issues/5502. Please consider switching to [testcafe-cucumber-steps](https://github.com/Marketionist/testcafe-cucumber-steps) or [webdriverio-cucumber-steps](https://github.com/Marketionist/webdriverio-cucumber-steps)\n\n[![Build Status](https://travis-ci.org/Marketionist/protractor-numerator.svg?branch=master)](https://travis-ci.org/Marketionist/protractor-numerator)\n[![npm version](https://img.shields.io/npm/v/protractor-numerator.svg)](https://www.npmjs.com/package/protractor-numerator)\n[![NPM License](https://img.shields.io/npm/l/protractor-numerator.svg)](https://github.com/Marketionist/protractor-numerator/blob/master/LICENSE)\n\nThis module gives you readable functions for getting elements by their numbers inside Protractor tests\n\n## Supported versions\n[Node.js](http://nodejs.org/):\n- 6.x\n- 7.x\n- 8.x\n- 9.x\n- 10.x\n\n[Protractor](https://www.npmjs.com/package/protractor):\n- 4.x\n- 5.x\n\n## Installation\n`npm install protractor-numerator --save-dev`\n\n## Importing and enabling\nYou can require protractor-numerator in `onPrepare` block inside\n`protractor.config.js`. Here is a short config example:\n\n```javascript\nexports.config = {\n    directConnect: true,\n\n    framework: 'jasmine2',\n\n    specs: [\n        'spec.js'\n    ],\n\n    capabilities: {\n        browserName: 'chrome'\n    },\n\n    onPrepare: function () {\n        global.numerator = require('protractor-numerator').numerator;\n        protractor.ElementArrayFinder.prototype = Object.assign(\n            protractor.ElementArrayFinder.prototype, numerator);\n        // Some other code that needs to be executed before all tests\n    }\n};\n```\n\n## Usage\nFor example let's take a small HTML list:\n\n```html\n\u003cul class=\"items\"\u003e\n    \u003cli\u003eFirst\u003c/li\u003e\n    \u003cli\u003eSecond\u003c/li\u003e\n    \u003cli\u003eThird\u003c/li\u003e\n    \u003cli\u003eFourth\u003c/li\u003e\n    \u003cli\u003eFifth\u003c/li\u003e\n    \u003cli\u003eSixth\u003c/li\u003e\n    \u003cli\u003eSeventh\u003c/li\u003e\n    \u003cli\u003eEighth\u003c/li\u003e\n    \u003cli\u003eNinth\u003c/li\u003e\n    \u003cli\u003eTenth\u003c/li\u003e\n    \u003cli\u003eEleventh\u003c/li\u003e\n    \u003cli\u003eTwelfth\u003c/li\u003e\n    \u003cli\u003eThirteenth\u003c/li\u003e\n    \u003cli\u003eFourteenth\u003c/li\u003e\n    \u003cli\u003eFifteenth\u003c/li\u003e\n    \u003cli\u003eSixteenth\u003c/li\u003e\n    \u003cli\u003eSeventeenth\u003c/li\u003e\n    \u003cli\u003eEighteenth\u003c/li\u003e\n    \u003cli\u003eNineteenth\u003c/li\u003e\n    \u003cli\u003eTwentieth\u003c/li\u003e\n\u003c/ul\u003e\n```\n\nInside your Protractor end-to-end tests you can get any element of this list like this:\n\n```javascript\n// Get all \u003cli\u003e elements from the list with class \"items\" and select one particular element by its number:\nlet listItemSecond = element.all(by.css('.items li')).second();\nlet listItemThird = element.all(by.xpath('//li[ancestor::*[@class=\"items\"]]')).third();\nlet listItemFourth = element.all(by.css('.items li')).fourth();\nlet listItemFifth = element.all(by.css('.items li')).fifth();\nlet listItemSixth = element.all(by.css('.items li')).sixth();\nlet listItemSeventh = element.all(by.css('.items li')).seventh();\nlet listItemEighth = element.all(by.css('.items li')).eighth();\nlet listItemNinth = element.all(by.css('.items li')).ninth();\nlet listItemTenth = element.all(by.css('.items li')).tenth();\nlet listItemEleventh = element.all(by.css('.items li')).eleventh();\nlet listItemTwelfth = element.all(by.css('.items li')).twelfth();\nlet listItemThirteenth = element.all(by.css('.items li')).thirteenth();\nlet listItemFourteenth = element.all(by.css('.items li')).fourteenth();\nlet listItemFifteenth = element.all(by.css('.items li')).fifteenth();\nlet listItemSixteenth = element.all(by.css('.items li')).sixteenth();\nlet listItemSeventeenth = element.all(by.css('.items li')).seventeenth();\nlet listItemEighteenth = element.all(by.css('.items li')).eighteenth();\nlet listItemNineteenth = element.all(by.css('.items li')).nineteenth();\nlet listItemTwentieth = element.all(by.css('.items li')).twentieth();\n\n// Now you can do whatever you want with any element for example validate its text:\nexpect(listItemSecond.getText()).toBe('Second');\nexpect(listItemThird.getText()).toBe('Third');\nexpect(listItemFourth.getText()).toBe('Fourth');\nexpect(listItemFifth.getText()).toBe('Fifth');\nexpect(listItemSixth.getText()).toBe('Sixth');\nexpect(listItemSeventh.getText()).toBe('Seventh');\nexpect(listItemEighth.getText()).toBe('Eighth');\nexpect(listItemNinth.getText()).toBe('Ninth');\nexpect(listItemTenth.getText()).toBe('Tenth');\nexpect(listItemEleventh.getText()).toBe('Eleventh');\nexpect(listItemTwelfth.getText()).toBe('Twelfth');\nexpect(listItemThirteenth.getText()).toBe('Thirteenth');\nexpect(listItemFourteenth.getText()).toBe('Fourteenth');\nexpect(listItemFifteenth.getText()).toBe('Fifteenth');\nexpect(listItemSixteenth.getText()).toBe('Sixteenth');\nexpect(listItemSeventeenth.getText()).toBe('Seventeenth');\nexpect(listItemEighteenth.getText()).toBe('Eighteenth');\nexpect(listItemNineteenth.getText()).toBe('Nineteenth');\nexpect(listItemTwentieth.getText()).toBe('Twentieth');\n```\n\n## Thanks\nIf this plugin was helpful for you, please give it a **★ Star** on\n[Github](https://github.com/Marketionist/protractor-numerator)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarketionist%2Fprotractor-numerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarketionist%2Fprotractor-numerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarketionist%2Fprotractor-numerator/lists"}