我有一个Python selenium脚本,它在ubuntu14.04中运行,但是当我尝试在ubuntu15.04上运行时,它显示了我的错误
=====================================================================
ERROR: test_google (__main__.TestGoogle)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_google.py", line 38, in test_google
sel.open(varc)
File "/home/rohitjha/.local/lib/python2.7/site-packages/selenium/selenium.py", line 791, in open
self.do_command("open", [url,ignoreResponseCode])
File "/home/rohitjha/.local/lib/python2.7/site-packages/selenium/selenium.py", line 231, in do_command
raise Exception(data)
Exception: Timed out after 30000ms
----------------------------------------------------------------------
Ran 1 test in 43.938s
FAILED (errors=1)
这是我的剧本
from selenium import selenium
import unittest
class TestGoogle(unittest.TestCase):
def setUp(self):
self.selenium = selenium("localhost", \
4444, "*firefox", "http://www.google.com/webhp")
#self.selenium.set_timeout('60000')
self.selenium.start()
def test_google(self):
sel = self.selenium
sel.open("http://www.google.com/webhp")
#sel.wait_for_page_to_load(5000)
print sel.get_location()
sel.open(sel.get_location())
sel.type("q", "hello world")
sel.click("btnG")
#sel.wait_for_page_to_load(500000)
varc= sel.get_location()
print varc
sel.open(varc)
#sel.wait_for_page_to_load(50000)
self.assertEqual("hello world - Google Search", sel.get_title())
def tearDown(self):
self.selenium.stop()
if __name__ == "__main__":
unittest.main()`
目前没有回答
相关问题 更多 >
编程相关推荐