{"id":26845591,"url":"https://github.com/automatedowl/selenium-download-kpi","last_synced_at":"2025-04-30T20:26:31.541Z","repository":{"id":123505378,"uuid":"135830554","full_name":"AutomatedOwl/selenium-download-kpi","owner":"AutomatedOwl","description":"Selenium extension for Java which provides KPIs of file downloads.","archived":false,"fork":false,"pushed_at":"2019-11-15T23:31:45.000Z","size":3813,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T19:38:07.507Z","etag":null,"topics":["allure-java","allure2","bandwidth","chromedriver","downloader","java","kpi","quality-of-experience","selenium"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AutomatedOwl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-02T15:43:14.000Z","updated_at":"2023-04-11T14:58:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"c01a1889-89a7-42e3-8def-760aa7bdd320","html_url":"https://github.com/AutomatedOwl/selenium-download-kpi","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AutomatedOwl%2Fselenium-download-kpi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AutomatedOwl%2Fselenium-download-kpi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AutomatedOwl%2Fselenium-download-kpi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AutomatedOwl%2Fselenium-download-kpi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AutomatedOwl","download_url":"https://codeload.github.com/AutomatedOwl/selenium-download-kpi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251777231,"owners_count":21642126,"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":["allure-java","allure2","bandwidth","chromedriver","downloader","java","kpi","quality-of-experience","selenium"],"created_at":"2025-03-30T19:37:19.545Z","updated_at":"2025-04-30T20:26:31.518Z","avatar_url":"https://github.com/AutomatedOwl.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# selenium-download-kpi\n\nSelenium extension for Java which provides KPIs of file download.\nCurrently, the library supports Chromedriver. It would allow you:\n\n* To define your download folder both globally and locally in one code line.\n* Given a file name, web element and timeout, you would be able to download a file and verify its success. \n* Logging the download bandwidth in Mbps and attaching it to Allure report.\n* Assertion of download bandwidth, where you define a numeric threshold for passing/failing the test.  \n\n### Setting up your test\n\nTo easily define your download folder, create a new instance of SeleniumDownloadKPI object, \nwith the download folder path supplied as String parameter.\n\nAfter initialization of SeleniumDownloadKPI object, and before initializing your Chromedriver object, use generateDownloadFolderCapability() method to get ChromeOptions object which contains your download folder, then pass it to Chromedriver constructor.\n\n```\n    private SeleniumDownloadKPI seleniumDownloadKPI;\n\n    @BeforeEach\n    void setUpTest() {\n        seleniumDownloadKPI =\n             new SeleniumDownloadKPI(\"/tmp/downloads\");\n        ChromeOptions chromeOptions =\n                seleniumDownloadKPI.generateDownloadFolderCapability();\n        driver = new ChromeDriver(chromeOptions);\n    }\n```\n\n### Example of file download with bandwidth attachment:\n\nThe method fileDownloadKPI() receives three parameters:\n\nWebElement object: adamInternetPage.getFileDownloadLink() returns a WebElement of download link.\n\nString object: \"SpeedTest_16MB.dat\" describes the file name which intended to be downloaded.\n\nboolean deleteFile: Indicates whether to delete or keep the file after the download finishes.\n\nThe method would perform a download using a default timeout of five minutes, and would also throw an exception in case of unsuccessful download.\n\n```\n    @Test\n    void downloadAttachTest() throws InterruptedException {\n        adamInternetPage.navigateToPage(driver);\n        seleniumDownloadKPI.fileDownloadKPI(\n                adamInternetPage.getFileDownloadLink(), \"SpeedTest_16MB.dat\", true);\n        waitBeforeClosingBrowser();\n    }\n```\n\n### Example of file download with bandwidth attachment (custom timeout):\n\nAlternative variation of fileDownloadKPI() method.\nThe method would act exactly the same as described above, just with a custom download timeout of one minute passed as third argument (in milliseconds).\n\n``` \n    @Test\n    void downloadAttachCustomTimeoutTest() throws InterruptedException {\n        adamInternetPage.navigateToPage(driver);\n        seleniumDownloadKPI.fileDownloadKPI(\n                adamInternetPage.getFileDownloadLink(),\n                \"SpeedTest_16MB.dat\", 60000, true);\n        waitBeforeClosingBrowser();\n    }\n```\n\n### Example of file download with attachment and assertion:\n\nThe method fileDownloadAssertKPI() receives four parameters:\n\nWebElement object: adamInternetPage.getFileDownloadLink() returns WebElement of download link.\n\nString object: \"SpeedTest_16MB.dat\" describes the file name which intended to be downloaded.\n\nLong value '5' is the Mbps threshold for the file download. If the download bandwidth would be less than 5Mbps, exception would be thrown.\n\nboolean deleteFile: Indicates whether to delete or keep the file after the download finishes.\n\nIt also uses a default download timeout of five minutes. \n\n```\n    @Test\n    void downloadAssertTest() throws InterruptedException {\n        adamInternetPage.navigateToPage(driver);\n        seleniumDownloadKPI.fileDownloadAssertKPI(\n                adamInternetPage.getFileDownloadLink(),\n                \"SpeedTest_16MB.dat\", 5, true);\n        waitBeforeClosingBrowser();\n    }\n```\n\n### Example of file download with attachment and assertion (custom timeout):\n\nAlternative variation of fileDownloadAssertKPI() method.\nThe method would act exactly the same as described above, just with a custom download timeout of one minute passed as fourth argument (in milliseconds).\n\n```\n    @Test\n    void downloadAssertTest() throws InterruptedException {\n        adamInternetPage.navigateToPage(driver);\n        seleniumDownloadKPI.fileDownloadAssertKPI(\n                 adamInternetPage.getFileDownloadLink(),\n                 \"SpeedTest_16MB.dat\", 5, 60000, true);\n        waitBeforeClosingBrowser();\n    }\n```\n\n### Sanpshot of file download with bandwidth attachment in Allure report:\n![Bandwidth Attachment](.github/bandwidth-attachment.png)\n\n### Sanpshot of bandwidth exception:\n![Bandwidth Exception](.github/bandwidth-exception.png)\n\n### Sanpshot of bandwidth logging:\n![Bandwidth Logging](.github/bandwidth-log.png)\n\n### Maven repository\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.automatedowl\u003c/groupId\u003e\n  \u003cartifactId\u003eselenium-download-kpi\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.3\u003c/version\u003e\n\u003c/dependency\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautomatedowl%2Fselenium-download-kpi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fautomatedowl%2Fselenium-download-kpi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautomatedowl%2Fselenium-download-kpi/lists"}