Sep-10-2019, 05:26 AM
Here is the code which opens the url and after loading the page, it will kill the driver. Again it will open another session for next link in the file and it will close the driver once loading is done
import selenium.webdriver with open('dataFile.txt', 'r') as urlFile: for url in urlFile.readlines(): print(url) driver = selenium.webdriver.Chrome(r"C:\Users\Malathi\Downloads\chromedriver_win32\chromedriver.exe") driver.get(url, ) link = driver.find_element_by_xpath("/html/body") link.click() driver.quit() urlFile.close()