- 论坛徽章:
- 0
|
这一个测试用例,判断有没有登录成功, self.assertEqual(sel.getValue("xpath=//*[@id='settings-email-address']"), self.verificationErrors),提示错误
selenium' object has no attribute 'getValue
求解答
# coding=gbk
from selenium import selenium
import unittest, time, re
class NewTest(unittest.TestCase):
def setUp(self):
self.verificationErrors = ["xxxxx@163.com"]
self.selenium = selenium("localhost", 4444, "*chrome", "http://xxxxxx.com/")
self.selenium.start()
def test_denglu(self):
sel = self.selenium
sel.open("/account/login.php")
sel.click(u"link=登录")
sel.wait_for_page_to_load("30000")
sel.type("login-email-address", "xxxxx@163.com")
sel.type("login-password", "111111")
sel.click("login-submit")
sel.wait_for_page_to_load("30000")
sel.click("myaccount")
sel.wait_for_page_to_load("30000")
sel.click("//div[@id='dashboard']/ul/li[6]/a")
/html/body/div/div[3]/div[6]/div/div/div/ul/li[7]/a
sel.wait_for_page_to_load("30000")
self.assertEqual(sel.getValue("xpath=//*[@id='settings-email-address']"), self.verificationErrors)
def tearDown(self):
self.selenium.stop()
# self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main() |
|