测试google搜索的代码
2012-08-12 15:41
337 查看
#!/usr/bin/env python # Copyright 2012 splinter authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. import unittest from splinter import Browser class TestGoogleSearch(unittest.TestCase): @classmethod def setUpClass(cls): cls.browser = Browser() @classmethod def tearDownClass(cls): cls.browser.quit() def test_visiting_google_com_returns_a_page_with_Google_in_title(self): self.browser.visit('http://www.google.com/') self.assertIn('Google', self.browser.title) def test_filling_Splinter_in_the_search_box_returns_Splinter_website(self): self.browser.visit('http://www.google.com.hk/') self.browser.fill('q', 'Splinter') search_button = self.browser.find_by_name('btnK').first while not search_button.visible: # waits for the JavaScript to put the button on the page pass search_button.click() self.assertTrue(self.browser.is_text_present('splinter.cobrateam.info')) unittest.main()
相关文章推荐
- GoogleTest框架测试C++代码
- Google正测试其新版搜索页面 不久将推向全球
- google搜索代码
- Google 搜索结果的网页摘要测试工具
- Google和Baidu的站内搜索代码
- PHP特级课视频教程_第二十八集 PHP搜索代码测试_李强强
- Ubuntu安装GoogleTest框架并测试C++代码
- 灵活使用Google的代码搜索
- 在aspx页中使用Google搜索代码
- Google和百度、雅虎的站内搜索代码
- google 代码搜索
- google站内搜索代码
- Google和百度、雅虎的站内搜索代码
- Google和百度、雅虎的站内搜索代码
- Google和百度、雅虎的站内搜索代码
- 通过谷歌Google轻松拥有自己的站内搜索代码
- Google和百度、雅虎的站内搜索代码
- 添加百度google搜索(转,未测试)
- Google站内搜索代码
- Google 百度 站内搜索代码