Selenium是thoughtworks公司的一个集成测试的强大工具,关于它的好处网络随处可以搜到,我就不一一介绍,在之前见到一个系列是Selenium Remote Control For Java,在这里模仿一下,主要以Python来实现。一是我比较喜欢用Python,二是刚好可以练手,熟悉熟悉Python开发Selenium RC脚本。
What is Selenium?
Selenium is a testing tool for web applications that uses JavaScript and Iframes to run tests directly in a browser. There are several test tools based on this technology: Selenium Core, Selenium IDE, Selenium Remote Control, and Selenium on Rails.
下面的是第一个例子:
在http://www.bitmotif.com/上点击link=Test Page For Selenium Remote Control,检查新页面的标题
代码
from selenium import selenium
import unittest
class ExampleTest(unittest.TestCase):
MAX_WAIT_TIME_IN_MS = 60000
BASE_URL = "http://www.bitmotif.com"