Customizable driver

This commit is contained in:
boyska 2014-05-18 19:47:22 +02:00
parent 7ae7ebc6a6
commit a43f93be58
2 changed files with 4 additions and 3 deletions

View file

@ -1,4 +1,5 @@
{
"datadir": "data/",
"browserdriver": "phantomjs",
"credfile": "cred.txt"
}

View file

@ -15,8 +15,8 @@ def read_pass_file(fname):
return user, pwd
def get_calls(user, password):
with Browser('phantomjs') as b:
def get_calls(user, password, driver='firefox'):
with Browser(driver) as b:
b.visit('https://www.messagenet.com/')
b.fill('userid', user)
b.fill('password', password)
@ -43,5 +43,5 @@ if __name__ == '__main__':
if len(sys.argv) == 2:
conf.update(json.load(open(sys.argv[1])))
user, password = read_pass_file(conf['credfile'])
calls = tuple(get_calls(user, password))
calls = tuple(get_calls(user, password, conf['browserdriver']))
save_calls(calls, conf['datadir'])