我在計算如何取出硒條中沒有必要的東西時遇到了一些麻煩,並且可以用另一個腳本將它打包。我無法理解這是怎麼回事,因爲我沒有得到單元testint部分來自哪裏...理想情況下,如果我可以將它分解成一個函數,我可以稱這將是想法,感謝任何建議。硒與Python,如何簡化腳本,以便我可以從其他Python腳本運行它們?
(AND,是的,我確實需要硒,我懇請所以我需要這個了,你請不建議,因爲我將使用硒的東西很多替代品)
這只是一個基本的演示腳本:
from selenium import selenium
import unittest
class TestGoogle(unittest.TestCase):
def setUp(self):
self.selenium = selenium("localhost", \
4444, "*firefox", "http://www.bing.com")
self.selenium.start()
def test_google(self):
sel = self.selenium
sel.open("http://www.google.com/webhp")
sel.type("q", "hello world")
sel.click("btnG")
sel.wait_for_page_to_load(5000)
self.assertEqual("hello world - Google Search", sel.get_title())
def tearDown(self):
self.selenium.stop()
if __name__ == "__main__":
unittest.main()
哦,我只是發現這個:http://coreygoldberg.blogspot.com/2009/09/selenium-rc-with-python-in-30-seconds.html這似乎是我在找什麼,我會離開這個,因爲沒有很多關於這個話題,我可以找到 – Rick 2010-08-26 18:12:06