Source

cmcc / debug_data / selenium_auto.py

Full commit
gao shuai d6b2a92 
































from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
import unittest, time, re

class Dd(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Firefox()
        self.driver.implicitly_wait(30)
        self.base_url = "http://221.176.1.140/"
        self.verificationErrors = []
    
    def test_dd(self):
        driver = self.driver
        driver.get(self.base_url + "/wlan/index.php?wlanacname=0361.0371.371.00&wlanuserip=111.7.63.111&ssid=CMCC")
        # ERROR: Caught exception [ERROR: Unsupported command [selectFrame]]
        driver.find_element_by_id("staticusernameid").clear()
        driver.find_element_by_id("staticusernameid").send_keys("13829107673")
        driver.find_element_by_id("staticpasswordid").clear()
        driver.find_element_by_id("staticpasswordid").send_keys("252806")
        driver.find_element_by_css_selector("input[type=\"submit\"]").click()
    
    def is_element_present(self, how, what):
        try: self.driver.find_element(by=how, value=what)
        except NoSuchElementException, e: return False
        return True
    
    def tearDown(self):
        self.driver.quit()
        self.assertEqual([], self.verificationErrors)

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