【发布时间】:2011-10-10 05:32:37
【问题描述】:
当我在 Win XP Internet Explorer 8 上运行 Selenium 测试时,测试不会重新开始。它将使用上次运行的 cookie/缓存开始测试。当我在 Firefox 中运行测试时,不会发生这种情况。
有没有人有解决方法?最好用 Python
我的一些想法:
- 在 tearDownClass 中运行一个脚本,删除所有临时文件:C:\Documents and Settings\Owner\Local Settings\Temporary Internet Files
- 而不是“*iehta”作为浏览器,我将它设置为 Internet Explorer 私有模式“*custom C:\Program Files\Internet Explorer\iexplore.exe -private”(--由于我的语法关闭,这不起作用?
谢谢。
import unittest, inspect, time, re, os
from selenium import selenium
class TESTVerifications(unittest.TestCase):
@classmethod
def setUpClass(self):
self.selenium = selenium("localhost", 4444, "*iehta", "https://workflowy.com/")
self.selenium.start()
self.selenium.set_timeout("60000")
print("setUpClass")
self.selenium.window_maximize()
self.selenium.open("/")
def setUp(self):
self.verificationErrors = []
def test_login_6(self):
sel = self.selenium
sel.open("/")
sel.type("css=input[id='id_username']",'test+abc010@workflowy.com' )
sel.type("css=input[id='id_password']",'password')
sel.click("css=form[id='login'] > input.submit")
sel.wait_for_page_to_load("60000")
self.failUnless(sel.is_element_present("id=logout"))
def tearDown(self):
#self.selenium.stop()
self.assertEqual([], self.verificationErrors,"Results: " + str(self.verificationErrors))
@classmethod
def tearDownClass(self):
self.selenium.stop()
print("tearDownClass")
if __name__ == "__main__":
unittest.main()
【问题讨论】:
标签: python internet-explorer selenium