<s> from splinter import Browser <EOL> import json , getopt <EOL> import re <EOL> import sys <EOL> import time <EOL> test_config = None <EOL> def usage ( argv ) : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" % argv [ <NUM_LIT:0> ] <EOL> def get_sha256_checksum_from_file ( file ) : <EOL> f = open ( file , "<STR_LIT:r>" ) <EOL> s = f . readline ( ) <EOL> f . close ( ) <EOL> checksum = re . sub ( "<STR_LIT>" , "<STR_LIT>" , s ) <EOL> return checksum <EOL> def main ( argv ) : <EOL> try : <EOL> opts , args = getopt . getopt ( sys . argv [ <NUM_LIT:1> : ] , "<STR_LIT>" ) <EOL> except getopt . GetoptError as err : <EOL> sys . exit ( <NUM_LIT:2> ) <EOL> global test_config <EOL> config_file_name = None <EOL> for o , a in opts : <EOL> if o == "<STR_LIT>" : <EOL> config_file_name = a <EOL> else : <EOL> assert False , "<STR_LIT>" <EOL> if config_file_name is None : <EOL> usage ( argv ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> config_file = open ( config_file_name , "<STR_LIT:r>" ) <EOL> test_config = json . load ( config_file ) <EOL> browser = Browser ( ) <EOL> browser . visit ( test_config [ '<STR_LIT:url>' ] ) <EOL> browser . find_by_id ( '<STR_LIT>' ) . fill ( test_config [ '<STR_LIT:username>' ] ) <EOL> browser . find_by_id ( '<STR_LIT>' ) . fill ( test_config [ '<STR_LIT:password>' ] ) <EOL> browser . find_by_id ( '<STR_LIT>' ) . click ( ) <EOL> browser . find_by_id ( '<STR_LIT>' ) . click ( ) <EOL> browser . find_by_id ( '<STR_LIT>' ) . click ( ) <EOL> browser . find_by_id ( '<STR_LIT>' ) . click ( ) <EOL> e = browser . find_by_id ( '<STR_LIT>' ) <EOL> e . fill ( test_config [ '<STR_LIT>' ] ) <EOL> e = browser . find_by_id ( '<STR_LIT>' ) <EOL> sha256_checksum = get_sha256_checksum_from_file ( test_config [ '<STR_LIT>' ] + "<STR_LIT>" ) <EOL> e . fill ( sha256_checksum ) <EOL> quit = False <EOL> while quit == False : <EOL> try : <EOL> if browser . is_text_present ( "<STR_LIT>" , <NUM_LIT:20> ) : <EOL> print "<STR_LIT>" <EOL> quit = True <EOL> except : <EOL> print "<STR_LIT>" <EOL> quit = True <EOL> time . sleep ( <NUM_LIT:10> ) <EOL> browser . quit ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( sys . argv ) </s>
