import time import webbrowser from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.support.ui import WebDriverWait from tkinter import * from tkinter.filedialog import askopenfile print (">>> URL Check-Back Tool <<< ") print (">>> Made by s1nical <<< ") # When the script calls "code", it's asking for values from the .txt file which you provided, that contains all of the URL paths that # should go after the last trailing slash in your URL in line 27, "driver.get("http://example.com/" + code)". driver = webdriver.Chrome("C:/chromedriver.exe"); xPath = """//*[@id="app-mount"]/div[1]/div/div[2]/div/section/div/div[1]""" count = 0 might = 0 attempts = 0 file = askopenfile(filetypes=[("Text files","*.txt")]) codes = file.readlines() for code in codes: print(attempts) attempts += 1 driver.get("http://example.com/" + code) time.sleep(2) try: texter = driver.find_element_by_xpath(xPath) except NoSuchElementException: print ("Might be Valid \n \n \n \n %s - @s1nical - \n \n \n \n" % code) might += 1 continue if(texter.text == "Code Invalid"): print("Might: %d | Invalid: %d" % (might, attempts)) time.sleep(3); print("\n\tMight: %d \n\t Invalids: %d" % (might, attempts)) driver.close() input('Finished')