from selenium import selenium
import unittest, time, re

class test(unittest.TestCase):
    def setUp(self):
        self.verificationErrors = []
#        self.selenium = selenium("localhost", 4444, "*chrome", "http://portal/")
#        self.selenium = selenium("localhost", 4444, r"*googlechrome", "http://portal/")
#        self.selenium = selenium("localhost", 4444, r"*googlechromeC:\Program Files\Google\Chrome\Application\chrome.exe", "http://portal/")
        self.selenium = selenium("localhost", 4444, "*iexplore", "http://portal/")
        self.selenium.start()
    
    def test_test(self):
        sel = self.selenium
        sel.open("/General/Login.aspx")
        sel.type("txtUserID", "004552")
        sel.type("txtPass", "N122119493")
        sel.click("rdblQuickMenu_0")
        sel.click("imgBtnSubmitNew")
        sel.wait_for_page_to_load("30000")
        sel.click("link2")
        sel.wait_for_pop_up("_self", "30000")
        sel.click("NTUHWeb1_ChartInputTextBox")
        sel.type("NTUHWeb1_ChartInputTextBox", "5527107")
        sel.click("NTUHWeb1_ButtonQuery")
        sel.wait_for_page_to_load("30000")
        sel.click("NTUHWeb1_PatAccountListRecord1_ShowOperationList")
        sel.wait_for_page_to_load("30000")
    
    def tearDown(self):
        self.selenium.stop()
        self.assertEqual([], self.verificationErrors)

if __name__ == "__main__":
    unittest.main()
