import time import threading from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import Select class BT67xxWebTest(): def __init__(self, ip): self.ip = ip self.web_thread = threading.Thread(target=self.test_update_in_thread, daemon=True) def connect(self): self.driver = webdriver.Firefox() self.driver.get('http://' + self.ip) def login(self): self.driver.find_element(By.ID, 'login').send_keys("admin") self.driver.find_element(By.ID, 'pass').send_keys("12345") self.driver.find_element(By.CLASS_NAME, 'btn.btn-primary').click() time.sleep(1) def go_to_iap(self): self.driver.get('http://' + self.ip + '/settings.html') self.driver.find_element(By.ID, 'tabset1__service').click() self.driver.find_element(By.ID, 'dev-update').click() select = Select(self.driver.find_element(By.ID, 'dev_update_method')) select.select_by_value('manual') self.driver.find_element(By.ID, 'start_fw_update').click() # Go to IAP! alert = self.driver.switch_to.alert alert.accept() time.sleep(12) self.driver.get('http://' + self.ip) time.sleep(1) print(self.driver.find_element(By.CLASS_NAME, 'fileUpload.btn.btn-primary').text) # print(self.driver.find_elements_by_name()) # self.driver.find_element(By.ID, 'uploadBtn2').click() def test_update_in_thread(self): pass def test_update(self): self.connect() self.login() self.go_to_iap() def main(): bt67xx = BT67xxWebTest("192.168.0.254") bt67xx.test_update() if __name__ == '__main__': main()