I'm trying to write an automated test script that will perform a set of actions for multiple URL's. The reason I am trying to do this is because I am testing a web application with multiple front-end interfaces that are functionally exactly the same, so if I can use a single test script to run through all of them and make sure the basics are in order, this saves me a lot of time in regression testing when the codebase changes.
My current code is as follows:
# initialize the unittest framework
# initialize the selenium framework and grab the toolbox for keyboard output
from selenium import selenium, webdriver
# prepare for the usage of remote browsers
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
# load up the remote driver and tell it to use Firefox
self.driver = webdriver.Remote(
driver = self.driver
# prepare the URL by loading the list from a textfile
with open('urllist.txt', 'r') as f:
urllist = [line.strip() for line in f]
# Go to the /admin url
for url in urllist:
# create the testurl
testurl = str(url) + str("/admin")
# go to the testurl
# log in using the admin credentials
# close the browser
# make it so!
if __name__ == "__main__":
I do not think string interpolation is required.