{"id":17478070,"url":"https://github.com/sunithvs/oose-selenium","last_synced_at":"2025-03-28T12:11:27.902Z","repository":{"id":116727308,"uuid":"595613168","full_name":"sunithvs/oose-selenium","owner":"sunithvs","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-31T13:05:37.000Z","size":524,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-18T23:20:55.076Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sunithvs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-01-31T13:00:22.000Z","updated_at":"2023-10-04T01:36:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"fc98d475-e529-4ff8-a91f-f8388b3459cc","html_url":"https://github.com/sunithvs/oose-selenium","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"d9c16f386452c1fccaf4356807d45e21bab627aa"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunithvs%2Foose-selenium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunithvs%2Foose-selenium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunithvs%2Foose-selenium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunithvs%2Foose-selenium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunithvs","download_url":"https://codeload.github.com/sunithvs/oose-selenium/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246026111,"owners_count":20711581,"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":[],"created_at":"2024-10-18T20:10:56.365Z","updated_at":"2025-03-28T12:11:27.882Z","avatar_url":"https://github.com/sunithvs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Automated Testing with Selenium\n\n### Submitted by: Sunith vs, CSB, 20220098 (Roll no)\n\n### Date: 31/01/2023\n\n## Introduction:\n\nIn this project, a Selenium script was created to automatically test the [eventsradar.in](http://eventsradar.in/) the website for the availability of event pages. The website, which is built on the Next.js framework, requires a rebuilding of the production environment every time a new event is added. The script uses the Chrome WebDriver API to check the presence of the body element on each event page and reports to the admin if a page is not available.\n\n### This is the code\n\n```python\nfrom selenium import webdriver\nfrom selenium.common.exceptions import TimeoutException\nfrom selenium.webdriver.chrome.service import Service as ChromeService\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.support import expected_conditions as EC\nfrom selenium.webdriver.support.ui import WebDriverWait\n\nfrom webdriver_manager.chrome import ChromeDriverManager\nfrom selenium import webdriver\nfrom selenium.webdriver.chrome.service import Service as ChromeService\nimport requests\n\ndef website_exists(url):\n    browser = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()))\n    browser.implicitly_wait(5)\n    driver = browser\n\n    # Set the timeout to 10 seconds\n    timeout = 5\n\n    try:\n        # Load the website\n        driver.get(url)\n\n        # Wait until the page has loaded\n        WebDriverWait(driver, timeout).until(\n            EC.presence_of_element_located((By.CLASS_NAME, \"next-error-h1\"))\n        )\n\n        print(\"Website not exists\")\n        return False\n    except TimeoutException:\n        print(\"Website exists\")\n        # If a TimeoutException is thrown, the website does not exist\n        return True\n    finally:\n        # Clean up the webdriver instance\n        driver.quit()\n\nevents_pages = requests.get(\"https://api.eventsradar.in/api/events/title/\").json()\nevents_pages.insert(0, \"test\")\nfor event in events_pages:\n    print(\"Checking\", event + \"...\")\n    status = website_exists(f\"https://eventsradar.in/event/{event}\")\n    print(\"Status:\", status, \"\\n\\n\")\n\n```\n\n### The output of the automation testing is as follows\n\n```python\nChecking test...\nWebsite not exists\nStatus: False \n\nChecking Container Security with NeuVector...\nWebsite exists\nStatus: True \n\nChecking Students Space Summit 2023...\nWebsite exists\nStatus: True \n\nChecking Odyssey...\nWebsite exists\nStatus: True \n\nChecking AutoCAD  Workshop...\nWebsite exists\nStatus: True \n\nChecking Nss-Quiz-Competition...\nWebsite exists\nStatus: True\n```\n\nscreen shots of the testing\n\n![selenium code checks the event page is available or not](eventpage.png)\n\nselenium code checks the event page is available or not\n\nThe goal of the project is to ensure a seamless user experience at the [eventsradar.in](http://eventsradar.in/) the website by promptly identifying and fixing any page loading issues. The Selenium script automates the manual effort of checking each event page and eliminates the need for manual testing. The script uses the Chrome WebDriver API to load the website and wait for the presence of the body element on each event page. If a TimeoutException is thrown, the website does not exist, and the script reports this to the admin.\n\n## Conclusion:\n\nAutomated website testing with Selenium provides a quick and efficient way to ensure the functionality of a website. In this project, a Selenium script was created to test the [eventsradar.in](http://eventsradar.in/) the website and report any page loading issues to the admin. The script uses the Chrome WebDriver API to load the website and check the presence of the body element on each event page. The project aimed to provide a seamless user experience by promptly identifying and fixing any page loading issues and has successfully achieved its goal.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunithvs%2Foose-selenium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunithvs%2Foose-selenium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunithvs%2Foose-selenium/lists"}