<s> from selenium import webdriver <EOL> from selenium . webdriver . common . by import By <EOL> from selenium . webdriver . support . ui import Select <EOL> from selenium . common . exceptions import NoSuchElementException <EOL> import unittest , time , re <EOL> class Reddit2 ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . driver = webdriver . Firefox ( ) <EOL> self . driver . implicitly_wait ( <NUM_LIT:30> ) <EOL> self . base_url = "<STR_LIT>" <EOL> self . verificationErrors = [ ] <EOL> self . accept_next_alert = true <EOL> def test_reddit2 ( self ) : <EOL> driver = self . driver <EOL> driver . find_element_by_xpath ( "<STR_LIT>" ) . click ( ) <EOL> def is_element_present ( self , how , what ) : <EOL> try : self . driver . find_element ( by = how , value = what ) <EOL> except NoSuchElementException , e : return False <EOL> return True <EOL> def close_alert_and_get_its_text ( self ) : <EOL> try : <EOL> alert = self . driver . switch_to_alert ( ) <EOL> if self . accept_next_alert : <EOL> alert . accept ( ) <EOL> else : <EOL> alert . dismiss ( ) <EOL> return alert . text <EOL> finally : self . accept_next_alert = True <EOL> def tearDown ( self ) : <EOL> self . driver . quit ( ) <EOL> self . assertEqual ( [ ] , self . verificationErrors ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
