Created
August 5, 2012 00:30
-
-
Save emanlove/3260821 to your computer and use it in GitHub Desktop.
selenium call which hangs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from selenium import webdriver | |
class SwitchToWindow(unittest.TestCase): | |
def setUp(self): | |
self.driver = webdriver.Firefox() | |
def test_switch_to_window(self): | |
driver = self.driver | |
driver.get("http://www.google.com") | |
driver.execute_script("return [ document.location ];") | |
print('Finished') | |
def tearDown(self): | |
self.driver.close() | |
if __name__ == "__main__": | |
unittest.main() | |
## python ../s2wissue.py | |
#^CTraceback (most recent call last): | |
# File "../s2wissue.py", line 32, in <module> | |
# unittest.main() | |
# File "/usr/lib/python2.6/unittest.py", line 817, in __init__ | |
# self.runTests() | |
# File "/usr/lib/python2.6/unittest.py", line 864, in runTests | |
# result = testRunner.run(self.test) | |
# File "/usr/lib/python2.6/unittest.py", line 753, in run | |
# test(result) | |
# File "/usr/lib/python2.6/unittest.py", line 464, in __call__ | |
# return self.run(*args, **kwds) | |
# File "/usr/lib/python2.6/unittest.py", line 460, in run | |
# test(result) | |
# File "/usr/lib/python2.6/unittest.py", line 464, in __call__ | |
# return self.run(*args, **kwds) | |
# File "/usr/lib/python2.6/unittest.py", line 460, in run | |
# test(result) | |
# File "/usr/lib/python2.6/unittest.py", line 300, in __call__ | |
# return self.run(*args, **kwds) | |
# File "/usr/lib/python2.6/unittest.py", line 279, in run | |
# testMethod() | |
# File "../s2wissue.py", line 17, in test_switch_to_window | |
# driver.execute_script("return [ document.location ];") | |
# File "/home/iamuser/s2l-test/clean-python26-env/lib/python2.6/site-packages/selenium-2.25.0-py2.6.egg/selenium/webdriver/remote/webdriver.py", line 388, in execute_script | |
# {'script': script, 'args':converted_args})['value'] | |
# File "/home/iamuser/s2l-test/clean-python26-env/lib/python2.6/site-packages/selenium-2.25.0-py2.6.egg/selenium/webdriver/remote/webdriver.py", line 154, in execute | |
# response = self.command_executor.execute(driver_command, params) | |
# File "/home/iamuser/s2l-test/clean-python26-env/lib/python2.6/site-packages/selenium-2.25.0-py2.6.egg/selenium/webdriver/remote/remote_connection.py", line 283, in execute | |
# return self._request(url, method=command_info[0], data=data) | |
# File "/home/iamuser/s2l-test/clean-python26-env/lib/python2.6/site-packages/selenium-2.25.0-py2.6.egg/selenium/webdriver/remote/remote_connection.py", line 324, in _request | |
# response = opener.open(request) | |
# File "/usr/lib/python2.6/urllib2.py", line 391, in open | |
# response = self._open(req, data) | |
# File "/usr/lib/python2.6/urllib2.py", line 409, in _open | |
# '_open', req) | |
# File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain | |
# result = func(*args) | |
# File "/usr/lib/python2.6/urllib2.py", line 1170, in http_open | |
# return self.do_open(httplib.HTTPConnection, req) | |
# File "/usr/lib/python2.6/urllib2.py", line 1143, in do_open | |
# r = h.getresponse() | |
# File "/usr/lib/python2.6/httplib.py", line 990, in getresponse | |
# response.begin() | |
# File "/usr/lib/python2.6/httplib.py", line 391, in begin | |
# version, status, reason = self._read_status() | |
# File "/usr/lib/python2.6/httplib.py", line 349, in _read_status | |
# line = self.fp.readline() | |
# File "/usr/lib/python2.6/socket.py", line 427, in readline | |
# data = recv(1) | |
#KeyboardInterrupt | |
## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ever find a reason for this? I'm hitting something similar right now.