Skip to content

Instantly share code, notes, and snippets.

@weissjeffm
Created January 2, 2014 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weissjeffm/8226054 to your computer and use it in GitHub Desktop.
Save weissjeffm/8226054 to your computer and use it in GitHub Desktop.
highlight fail
(cfme)[jweiss@localhost cfme_tests]$ py.test -k login
============================= test session starts ==============================
platform linux2 -- Python 2.7.5 -- pytest-2.5.1
collected 243 items
cfme/tests/test_login.py ..
tests/test_phantom_login.py F
tests/ui/test_login.py F
=================================== FAILURES ===================================
______________________________ test_phantom_login ______________________________
browser = <utils.browser.WebDriverWrapper object at 0x60ba650>
def test_phantom_login(browser):
"""https://bugzilla.redhat.com/show_bug.cgi?id=996284"""
login_pg = LoginPage(testsetup)
login_pg.go_to_login_page()
> next_pg = login_pg.login_and_send_window_size()
tests/test_phantom_login.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pages.login.LoginPage object at 0x60ba590>, args = (), kwargs = {}
def login_and_send_window_size(self, *args, **kwargs):
> return self._do_login(self._click_on_login_and_send_window_size, *args, **kwargs)
pages/login.py:56:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pages.login.LoginPage object at 0x60ba590>
continue_function = <bound method LoginPage._click_on_login_and_send_window_size of <pages.login.LoginPage object at 0x60ba590>>
user = 'default', force_dashboard = True
def _do_login(self, continue_function, user='default', force_dashboard=True):
> self._set_login_fields(user)
pages/login.py:59:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pages.login.LoginPage object at 0x60ba590>, user = 'default'
def _set_login_fields(self, user='default'):
credentials = self.testsetup.credentials[user]
> self.username.send_keys(credentials['username'])
pages/login.py:84:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webelement.WebElement object at 0x60ba050>
value = ('admin',), local_file = None, typing = ['a', 'd', 'm', 'i', 'n']
val = 'admin'
def send_keys(self, *value):
"""Simulates typing into the element.
:Args:
- value - A string for typing, or setting form fields. For setting
file inputs, this could be a local file path.
Use this to send simple key events or to fill out form fields::
form_textfield = driver.find_element_by_name('username')
form_textfield.send_keys("admin")
This can also be used to set file inputs.::
file_input = driver.find_element_by_name('profilePic')
file_input.send_keys("path/to/profilepic.gif")
# Generally it's better to wrap the file path in one of the methods
# in os.path to return the actual path to support cross OS testing.
# file_input.send_keys(os.path.abspath("path/to/profilepic.gif"))
"""
# transfer file to another machine only if remote driver is used
# the same behaviour as for java binding
if self.parent._is_remote:
local_file = LocalFileDetector.is_local_file(*value)
if local_file is not None:
value = self._upload(local_file)
typing = []
for val in value:
if isinstance(val, Keys):
typing.append(val)
elif isinstance(val, int):
val = val.__str__()
for i in range(len(val)):
typing.append(val[i])
else:
for i in range(len(val)):
typing.append(val[i])
> self._execute(Command.SEND_KEYS_TO_ELEMENT, {'value': typing})
../../.virtualenvs/cfme/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py:292:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webelement.WebElement object at 0x60ba050>
command = 'sendKeysToElement', params = {'value': ['a', 'd', 'm', 'i', 'n']}
def _execute(self, command, params=None):
> highlight(self)
cfme/fixtures/pytest_selenium.py:62:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
element = <selenium.webdriver.remote.webelement.WebElement object at 0x60ba050>
def highlight(element):
"""Highlights (blinks) a Webdriver element.
In pure javascript, as suggested by https://github.com/alp82.
"""
browser().execute_script("""
element = arguments[0];
original_style = element.getAttribute('style');
element.setAttribute('style', original_style + "; background: yellow;");
setTimeout(function(){
element.setAttribute('style', original_style);
}, 30);
> """, element)
cfme/fixtures/pytest_selenium.py:55:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.firefox.webdriver.WebDriver object at 0x609e790>
script = "\n element = arguments[0];\n original_style = element.getAttribute('style');\n eleme...Timeout(function(){\n element.setAttribute('style', original_style);\n }, 30);\n "
args = (<selenium.webdriver.remote.webelement.WebElement object at 0x60ba050>,)
converted_args = [<selenium.webdriver.remote.webelement.WebElement object at 0x60ba050>]
def execute_script(self, script, *args):
"""
Synchronously Executes JavaScript in the current window/frame.
:Args:
- script: The JavaScript to execute.
- \*args: Any applicable arguments for your JavaScript.
:Usage:
driver.execute_script('document.title')
"""
if len(args) == 1:
converted_args = args[0]
else:
converted_args = list(args)
converted_args = list(args)
return self.execute(Command.EXECUTE_SCRIPT,
> {'script': script, 'args':converted_args})['value']
../../.virtualenvs/cfme/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py:396:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.firefox.webdriver.WebDriver object at 0x609e790>
driver_command = 'executeScript'
params = {'args': [{'ELEMENT': '0'}], 'script': "\n element = arguments[0];\n original_style = element.ge...ute('style', original_style);\n }, 30);\n ", 'sessionId': '7f54ec51-b9ee-46d1-adf8-248f3d2f2398'}
def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
The command's JSON response loaded into a dictionary object.
"""
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
> response = self.command_executor.execute(driver_command, params)
../../.virtualenvs/cfme/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.firefox.extension_connection.ExtensionConnection object at 0x609ec50>
command = 'executeScript'
params = {'args': [{'ELEMENT': '0'}], 'script': "\n element = arguments[0];\n original_style = element.ge...ute('style', original_style);\n }, 30);\n ", 'sessionId': '7f54ec51-b9ee-46d1-adf8-248f3d2f2398'}
def execute(self, command, params):
"""
Send a command to the remote server.
Any path subtitutions required for the URL mapped to the command should be
included in the command parameters.
:Args:
- command - A string specifying the command to execute.
- params - A dictionary of named parameters to send with the command as
its JSON payload.
"""
command_info = self._commands[command]
assert command_info is not None, 'Unrecognised command %s' % command
data = utils.dump_json(params)
path = string.Template(command_info[1]).substitute(params)
url = '%s%s' % (self._url, path)
> return self._request(url, method=command_info[0], data=data)
../../.virtualenvs/cfme/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.firefox.extension_connection.ExtensionConnection object at 0x609ec50>
url = 'http://127.0.0.1:39067/hub/session/7f54ec51-b9ee-46d1-adf8-248f3d2f2398/execute'
data = '{"sessionId": "7f54ec51-b9ee-46d1-adf8-248f3d2f2398", "args": [{"ELEMENT": "0"}], "script": "\\n element =...(function(){\\n element.setAttribute(\'style\', original_style);\\n }, 30);\\n "}'
method = 'POST'
def _request(self, url, data=None, method=None):
"""
Send an HTTP request to the remote server.
:Args:
- method - A string for the HTTP method to send the request with.
- url - The URL to send the request to.
- body - The message body to send.
:Returns:
A dictionary with the server's parsed JSON response.
"""
LOGGER.debug('%s %s %s' % (method, url, data))
parsed_url = parse.urlparse(url)
if self.keep_alive:
headers = {"Connection": 'keep-alive', method: parsed_url.path,
"User-Agent": "Python http auth",
"Content-type": "application/json;charset=\"UTF-8\"",
"Accept": "application/json"}
if parsed_url.username:
auth = base64.standard_b64encode('%s:%s' %
(parsed_url.username, parsed_url.password)).replace('\n', '')
headers["Authorization"] = "Basic %s" % auth
> self._conn.request(method, parsed_url.path, data, headers)
../../.virtualenvs/cfme/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py:376:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <httplib.HTTPConnection instance at 0x60a3ea8>, method = 'POST'
url = '/hub/session/7f54ec51-b9ee-46d1-adf8-248f3d2f2398/execute'
body = '{"sessionId": "7f54ec51-b9ee-46d1-adf8-248f3d2f2398", "args": [{"ELEMENT": "0"}], "script": "\\n element =...(function(){\\n element.setAttribute(\'style\', original_style);\\n }, 30);\\n "}'
headers = {'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-type': 'application/json;charset="UTF-8"', 'POST': '/hub/session/7f54ec51-b9ee-46d1-adf8-248f3d2f2398/execute', ...}
def request(self, method, url, body=None, headers={}):
"""Send a complete request to the server."""
> self._send_request(method, url, body, headers)
/usr/lib64/python2.7/httplib.py:973:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <httplib.HTTPConnection instance at 0x60a3ea8>, method = 'POST'
url = '/hub/session/7f54ec51-b9ee-46d1-adf8-248f3d2f2398/execute'
body = '{"sessionId": "7f54ec51-b9ee-46d1-adf8-248f3d2f2398", "args": [{"ELEMENT": "0"}], "script": "\\n element =...(function(){\\n element.setAttribute(\'style\', original_style);\\n }, 30);\\n "}'
headers = {'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-type': 'application/json;charset="UTF-8"', 'POST': '/hub/session/7f54ec51-b9ee-46d1-adf8-248f3d2f2398/execute', ...}
def _send_request(self, method, url, body, headers):
# Honor explicitly requested Host: and Accept-Encoding: headers.
header_names = dict.fromkeys([k.lower() for k in headers])
skips = {}
if 'host' in header_names:
skips['skip_host'] = 1
if 'accept-encoding' in header_names:
skips['skip_accept_encoding'] = 1
self.putrequest(method, url, **skips)
if body is not None and 'content-length' not in header_names:
self._set_content_length(body)
for hdr, value in headers.iteritems():
self.putheader(hdr, value)
> self.endheaders(body)
/usr/lib64/python2.7/httplib.py:1007:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <httplib.HTTPConnection instance at 0x60a3ea8>
message_body = '{"sessionId": "7f54ec51-b9ee-46d1-adf8-248f3d2f2398", "args": [{"ELEMENT": "0"}], "script": "\\n element =...(function(){\\n element.setAttribute(\'style\', original_style);\\n }, 30);\\n "}'
def endheaders(self, message_body=None):
"""Indicate that the last header line has been sent to the server.
This method sends the request to the server. The optional
message_body argument can be used to pass a message body
associated with the request. The message body will be sent in
the same packet as the message headers if it is string, otherwise it is
sent as a separate packet.
"""
if self.__state == _CS_REQ_STARTED:
self.__state = _CS_REQ_SENT
else:
raise CannotSendHeader()
> self._send_output(message_body)
/usr/lib64/python2.7/httplib.py:969:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <httplib.HTTPConnection instance at 0x60a3ea8>, message_body = None
def _send_output(self, message_body=None):
"""Send the currently buffered request and clear the buffer.
Appends an extra \\r\\n to the buffer.
A message_body may be specified, to be appended to the request.
"""
self._buffer.extend(("", ""))
msg = "\r\n".join(self._buffer)
del self._buffer[:]
# If msg and message_body are sent in a single send() call,
# it will avoid performance problems caused by the interaction
# between delayed ack and the Nagle algorithm.
if isinstance(message_body, str):
msg += message_body
message_body = None
> self.send(msg)
/usr/lib64/python2.7/httplib.py:829:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <httplib.HTTPConnection instance at 0x60a3ea8>
data = 'POST /hub/session/7f54ec51-b9ee-46d1-adf8-248f3d2f2398/execute HTTP/1.1
Host: 127.0.0.1:39067
Accept-Encoding: iden...out(function(){\n element.setAttribute(\'style\', original_style);\n }, 30);\n "}'
def send(self, data):
"""Send `data' to the server."""
if self.sock is None:
if self.auto_open:
> self.connect()
/usr/lib64/python2.7/httplib.py:791:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <httplib.HTTPConnection instance at 0x60a3ea8>
def connect(self):
"""Connect to the host and port specified in __init__."""
self.sock = socket.create_connection((self.host,self.port),
> self.timeout, self.source_address)
/usr/lib64/python2.7/httplib.py:772:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
address = ('127.0.0.1', '39067'), timeout = <object object at 0x7fd4348f6110>
source_address = None
def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT,
source_address=None):
"""Connect to *address* and return the socket object.
Convenience function. Connect to *address* (a 2-tuple ``(host,
port)``) and return the socket object. Passing the optional
*timeout* parameter will set the timeout on the socket instance
before attempting to connect. If no *timeout* is supplied, the
global default timeout setting returned by :func:`getdefaulttimeout`
is used. If *source_address* is set it must be a tuple of (host, port)
for the socket to bind as a source address before making the connection.
An host of '' or port 0 tells the OS to use the default.
"""
host, port = address
err = None
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
af, socktype, proto, canonname, sa = res
sock = None
try:
sock = socket(af, socktype, proto)
if timeout is not _GLOBAL_DEFAULT_TIMEOUT:
sock.settimeout(timeout)
if source_address:
sock.bind(source_address)
sock.connect(sa)
return sock
except error as _:
err = _
if sock is not None:
sock.close()
if err is not None:
> raise err
E error: [Errno 111] Connection refused
/usr/lib64/python2.7/socket.py:571: error
_____________________________ TestLogin.test_login _____________________________
self = <tests.ui.test_login.TestLogin instance at 0x623ecf8>
browser = <utils.browser.WebDriverWrapper object at 0x622e890>
def test_login(self, browser):
login_pg = LoginPage(testsetup)
login_pg.go_to_login_page()
> home_pg = login_pg.login()
tests/ui/test_login.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pages.login.LoginPage object at 0x622e9d0>, args = (), kwargs = {}
def login(self, *args, **kwargs):
> return self.login_with_mouse_click(*args, **kwargs)
pages/login.py:47:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pages.login.LoginPage object at 0x622e9d0>, args = (), kwargs = {}
def login_with_mouse_click(self, *args, **kwargs):
> return self._do_login(self._click_on_login_button, *args, **kwargs)
pages/login.py:53:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pages.login.LoginPage object at 0x622e9d0>
continue_function = <bound method LoginPage._click_on_login_button of <pages.login.LoginPage object at 0x622e9d0>>
user = 'default', force_dashboard = True
def _do_login(self, continue_function, user='default', force_dashboard=True):
> self._set_login_fields(user)
pages/login.py:59:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pages.login.LoginPage object at 0x622e9d0>, user = 'default'
def _set_login_fields(self, user='default'):
credentials = self.testsetup.credentials[user]
> self.username.send_keys(credentials['username'])
pages/login.py:84:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webelement.WebElement object at 0x622ec50>
value = ('admin',), local_file = None, typing = ['a', 'd', 'm', 'i', 'n']
val = 'admin'
def send_keys(self, *value):
"""Simulates typing into the element.
:Args:
- value - A string for typing, or setting form fields. For setting
file inputs, this could be a local file path.
Use this to send simple key events or to fill out form fields::
form_textfield = driver.find_element_by_name('username')
form_textfield.send_keys("admin")
This can also be used to set file inputs.::
file_input = driver.find_element_by_name('profilePic')
file_input.send_keys("path/to/profilepic.gif")
# Generally it's better to wrap the file path in one of the methods
# in os.path to return the actual path to support cross OS testing.
# file_input.send_keys(os.path.abspath("path/to/profilepic.gif"))
"""
# transfer file to another machine only if remote driver is used
# the same behaviour as for java binding
if self.parent._is_remote:
local_file = LocalFileDetector.is_local_file(*value)
if local_file is not None:
value = self._upload(local_file)
typing = []
for val in value:
if isinstance(val, Keys):
typing.append(val)
elif isinstance(val, int):
val = val.__str__()
for i in range(len(val)):
typing.append(val[i])
else:
for i in range(len(val)):
typing.append(val[i])
> self._execute(Command.SEND_KEYS_TO_ELEMENT, {'value': typing})
../../.virtualenvs/cfme/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py:292:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.webelement.WebElement object at 0x622ec50>
command = 'sendKeysToElement', params = {'value': ['a', 'd', 'm', 'i', 'n']}
def _execute(self, command, params=None):
> highlight(self)
cfme/fixtures/pytest_selenium.py:62:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
element = <selenium.webdriver.remote.webelement.WebElement object at 0x622ec50>
def highlight(element):
"""Highlights (blinks) a Webdriver element.
In pure javascript, as suggested by https://github.com/alp82.
"""
browser().execute_script("""
element = arguments[0];
original_style = element.getAttribute('style');
element.setAttribute('style', original_style + "; background: yellow;");
setTimeout(function(){
element.setAttribute('style', original_style);
}, 30);
> """, element)
cfme/fixtures/pytest_selenium.py:55:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.firefox.webdriver.WebDriver object at 0x609e790>
script = "\n element = arguments[0];\n original_style = element.getAttribute('style');\n eleme...Timeout(function(){\n element.setAttribute('style', original_style);\n }, 30);\n "
args = (<selenium.webdriver.remote.webelement.WebElement object at 0x622ec50>,)
converted_args = [<selenium.webdriver.remote.webelement.WebElement object at 0x622ec50>]
def execute_script(self, script, *args):
"""
Synchronously Executes JavaScript in the current window/frame.
:Args:
- script: The JavaScript to execute.
- \*args: Any applicable arguments for your JavaScript.
:Usage:
driver.execute_script('document.title')
"""
if len(args) == 1:
converted_args = args[0]
else:
converted_args = list(args)
converted_args = list(args)
return self.execute(Command.EXECUTE_SCRIPT,
> {'script': script, 'args':converted_args})['value']
../../.virtualenvs/cfme/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py:396:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.firefox.webdriver.WebDriver object at 0x609e790>
driver_command = 'executeScript'
params = {'args': [{'ELEMENT': '0'}], 'script': "\n element = arguments[0];\n original_style = element.ge...ute('style', original_style);\n }, 30);\n ", 'sessionId': '7f54ec51-b9ee-46d1-adf8-248f3d2f2398'}
def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
The command's JSON response loaded into a dictionary object.
"""
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
> response = self.command_executor.execute(driver_command, params)
../../.virtualenvs/cfme/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.firefox.extension_connection.ExtensionConnection object at 0x609ec50>
command = 'executeScript'
params = {'args': [{'ELEMENT': '0'}], 'script': "\n element = arguments[0];\n original_style = element.ge...ute('style', original_style);\n }, 30);\n ", 'sessionId': '7f54ec51-b9ee-46d1-adf8-248f3d2f2398'}
def execute(self, command, params):
"""
Send a command to the remote server.
Any path subtitutions required for the URL mapped to the command should be
included in the command parameters.
:Args:
- command - A string specifying the command to execute.
- params - A dictionary of named parameters to send with the command as
its JSON payload.
"""
command_info = self._commands[command]
assert command_info is not None, 'Unrecognised command %s' % command
data = utils.dump_json(params)
path = string.Template(command_info[1]).substitute(params)
url = '%s%s' % (self._url, path)
> return self._request(url, method=command_info[0], data=data)
../../.virtualenvs/cfme/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py:349:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.firefox.extension_connection.ExtensionConnection object at 0x609ec50>
url = 'http://127.0.0.1:39067/hub/session/7f54ec51-b9ee-46d1-adf8-248f3d2f2398/execute'
data = '{"sessionId": "7f54ec51-b9ee-46d1-adf8-248f3d2f2398", "args": [{"ELEMENT": "0"}], "script": "\\n element =...(function(){\\n element.setAttribute(\'style\', original_style);\\n }, 30);\\n "}'
method = 'POST'
def _request(self, url, data=None, method=None):
"""
Send an HTTP request to the remote server.
:Args:
- method - A string for the HTTP method to send the request with.
- url - The URL to send the request to.
- body - The message body to send.
:Returns:
A dictionary with the server's parsed JSON response.
"""
LOGGER.debug('%s %s %s' % (method, url, data))
parsed_url = parse.urlparse(url)
if self.keep_alive:
headers = {"Connection": 'keep-alive', method: parsed_url.path,
"User-Agent": "Python http auth",
"Content-type": "application/json;charset=\"UTF-8\"",
"Accept": "application/json"}
if parsed_url.username:
auth = base64.standard_b64encode('%s:%s' %
(parsed_url.username, parsed_url.password)).replace('\n', '')
headers["Authorization"] = "Basic %s" % auth
> self._conn.request(method, parsed_url.path, data, headers)
../../.virtualenvs/cfme/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py:376:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <httplib.HTTPConnection instance at 0x60a3ea8>, method = 'POST'
url = '/hub/session/7f54ec51-b9ee-46d1-adf8-248f3d2f2398/execute'
body = '{"sessionId": "7f54ec51-b9ee-46d1-adf8-248f3d2f2398", "args": [{"ELEMENT": "0"}], "script": "\\n element =...(function(){\\n element.setAttribute(\'style\', original_style);\\n }, 30);\\n "}'
headers = {'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-type': 'application/json;charset="UTF-8"', 'POST': '/hub/session/7f54ec51-b9ee-46d1-adf8-248f3d2f2398/execute', ...}
def request(self, method, url, body=None, headers={}):
"""Send a complete request to the server."""
> self._send_request(method, url, body, headers)
/usr/lib64/python2.7/httplib.py:973:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <httplib.HTTPConnection instance at 0x60a3ea8>, method = 'POST'
url = '/hub/session/7f54ec51-b9ee-46d1-adf8-248f3d2f2398/execute'
body = '{"sessionId": "7f54ec51-b9ee-46d1-adf8-248f3d2f2398", "args": [{"ELEMENT": "0"}], "script": "\\n element =...(function(){\\n element.setAttribute(\'style\', original_style);\\n }, 30);\\n "}'
headers = {'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-type': 'application/json;charset="UTF-8"', 'POST': '/hub/session/7f54ec51-b9ee-46d1-adf8-248f3d2f2398/execute', ...}
def _send_request(self, method, url, body, headers):
# Honor explicitly requested Host: and Accept-Encoding: headers.
header_names = dict.fromkeys([k.lower() for k in headers])
skips = {}
if 'host' in header_names:
skips['skip_host'] = 1
if 'accept-encoding' in header_names:
skips['skip_accept_encoding'] = 1
> self.putrequest(method, url, **skips)
/usr/lib64/python2.7/httplib.py:1001:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <httplib.HTTPConnection instance at 0x60a3ea8>, method = 'POST'
url = '/hub/session/7f54ec51-b9ee-46d1-adf8-248f3d2f2398/execute', skip_host = 0
skip_accept_encoding = 0
def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0):
"""Send a request to the server.
`method' specifies an HTTP request method, e.g. 'GET'.
`url' specifies the object being requested, e.g. '/index.html'.
`skip_host' if True does not add automatically a 'Host:' header
`skip_accept_encoding' if True does not add automatically an
'Accept-Encoding:' header
"""
# if a prior response has been completed, then forget about it.
if self.__response and self.__response.isclosed():
self.__response = None
# in certain cases, we cannot issue another request on this connection.
# this occurs when:
# 1) we are in the process of sending a request. (_CS_REQ_STARTED)
# 2) a response to a previous request has signalled that it is going
# to close the connection upon completion.
# 3) the headers for the previous response have not been read, thus
# we cannot determine whether point (2) is true. (_CS_REQ_SENT)
#
# if there is no prior response, then we can request at will.
#
# if point (2) is true, then we will have passed the socket to the
# response (effectively meaning, "there is no prior response"), and
# will open a new one when a new request is made.
#
# Note: if a prior response exists, then we *can* start a new request.
# We are not allowed to begin fetching the response to this new
# request, however, until that prior response is complete.
#
if self.__state == _CS_IDLE:
self.__state = _CS_REQ_STARTED
else:
> raise CannotSendRequest()
E CannotSendRequest
/usr/lib64/python2.7/httplib.py:871: CannotSendRequest
====================== 239 tests deselected by '-klogin' =======================
============= 2 failed, 2 passed, 239 deselected in 21.16 seconds ==============
Event testing disabled, no collecting, no reports
(cfme)[jweiss@localhost cfme_tests]$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment