当我在Win XP Internet Explorer 8上运行我的Selenium测试时,测试不会全新开始。它将使用之前运行的Cookie /缓存开始测试。当我在Firefox中运行测试时不会发生这种情况。 有没有人有这方面的解决方法?最好在Python
我的一些想法:
- 必须在删除所有临时文件tearDownClass运行一个脚本:C:\ Documents和Settings \用户\本地设置\ Temporary Internet Files文件
- 而不是“* iehta“作为浏览器,我将它设置为Internet Explorer私人模式”*自定义C:\ Program Files \ Internet Explorer \ iexplore.exe -private“( - 因为我的语法关闭而无法工作?Selenium Internet Explorer 8缓存问题
谢谢
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']",'[email protected]' )
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()
这对我很有用。谢谢! – gorbysbm