from selenium import webdriver
import time
class keepalive():
def setUp(self):
self.driver = webdriver.Firefox()
self.driver.implicitly_wait(30)
self.base_url = "歡迎頁麵的base url"
self.verificationErrors = []
def keep_alive(self):
driver = self.driver
driver.get(self.base_url + "歡迎頁麵地址其他部分")
driver.find_element_by_name("Submit").click()
def tearDown(self): # quit the browser
self.driver.quit()
if __name__ == "__main__":
test = keepalive()
while True: # this is a endless loop
test.setUp()
test.keep_alive()
test.tearDown()
time.sleep(3 * 3600) # wait for 3 hours
這個用python + Selenium 就解決了。見代碼:
所有跟帖:
• 當然,如果不用每次都打開歡迎頁麵的話,就更簡單了。 -在城裏- ♂ (0 bytes) () 11/10/2012 postreply 13:57:07