Selenium第一个例子

#!/usr/bin/env python
#
-*- coding: utf-8 -*-

from selenium import selenium
import unittest, time, re

class CreateProjectTestCase(unittest.TestCase):
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", 4444, "*chrome", "http://127.0.0.1/")
self.selenium.start()

def runTest(self):
sel = self.selenium
sel.open("/static/test.html")
sel.click("id=list2")
sel.mouse_move_at("id=list", "")
sel.click("id=z1")
sel.mouse_over("id=list")

def tearDown(self):
self.selenium.stop()
self.assertEqual([], self.verificationErrors)


if __name__ == "__main__":
unittest.main()

注意:Selenium的python WebDriver版本是不支持鼠标操作的!!!因此有鼠标操作只能上RM版本了

 

官方下载地址:

http://seleniumhq.org/download/

你可能感兴趣的:(selenium)