#coding=utf-8
from selenium import webdriver
import unittest,time
class Mytest1(unittest.TestCase):
def setUp(self):
self.driver=webdriver.Firefox()
self.base_url='https://mail.126.com/'
def test_login(self):
self.driver.get(self.base_url)
self.driver.switch_to.frame("x-URS-iframe")
self.driver.find_element_by_xpath("html/body/div[2]/div[2]/div[2]/form/div/div[1]/div[2]/input").clear()
self.driver.find_element_by_xpath("html/body/div[2]/div[2]/div[2]/form/div/div[1]/div[2]/input").send_keys("xxxxx")
self.driver.find_element_by_xpath("html/body/div[2]/div[2]/div[2]/form/div/div[3]/div[2]/input[2]").send_keys("xxxxxxx")
self.driver.find_element_by_id("dologin").click()
time.sleep(3)
text=self.driver.find_element_by_id("spnUid").text
self.assertEqual(text,"xxxxx@162.com")
self.driver.find_element_by_link_text(u"退出").click()
def tearDown(self):
pass
if name=="main":
unittest.main()
报错:selenium.common.exceptions.WebDriverException: Message: TypeError: can't access dead object