我正在尝试测试需要两个不同浏览器会话的聊天应用程序。我通过以下方式进行了尝试:
- Started 两种不同的浏览器,firefox 和 google chrome
- 试图打开该网站的主页。
以下是代码:
from selenium import selenium
from selenium import webdriver
from threading import Thread
import unittest, time, re
import time
class envolveChatCheck(unittest.TestCase):
def get_sauce_browser(self, port=4444, browser="*firefox"):
return selenium('localhost', port, browser, 'http://example.com/')
def get_browser_and_wait(self, browser, browser_num):
print "starting browser %s" % browser_num
browser.start()
browser.open("/")
print "browser %s ready" % browser_num
def setUp(self):
self.verificationErrors = []
self.b1 = self.get_sauce_browser(browser='*googlechrome', port=4444)
self.b2 = self.get_sauce_browser(browser='*firefox', port=4444)
print "all browsers ready"
def test_envolve_chat_check(self):
print "starting b1"
self.b1.start()
print "starting b2"
self.b2.start()
print "opening homepage b1"
self.b1.open("/")
self.b1.wait_for_page_to_load("30000")
print "opening homepage b2"
self.b2.open("/")
self.b2.wait_for_page_to_load("30000")
def tearDown(self):
self.b1.stop()
self.b2.stop()
self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main()
以下是我得到的错误:
Traceback (most recent call last):
File "envolveChatCheck.py", line 32, in test_envolve_chat_check
self.b1.open("/")
File "/usr/local/lib/python2.6/dist-packages/selenium/selenium.py", line 774, in open
self.do_command("open", [url,ignoreResponseCode])
File "/usr/local/lib/python2.6/dist-packages/selenium/selenium.py", line 214, in do_command
raise Exception, data
Exception: ERROR: Got a null result
对此有任何提示吗?