Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
c1613af
Corrected spelling of exception. Only instance in the java code.
Feb 21, 2013
9d5bb16
First batch of changes to support py2.6+ and py3.0+
Feb 6, 2013
6548e98
Second batch of changes for py2.6 and py3 concurrent support
Feb 7, 2013
efafbe2
Some more changes for py2,3 compatibility
Feb 11, 2013
9984abd
Rename builtin types for python 2.x
Feb 12, 2013
7b50e77
Decode strings as utf-8
Feb 12, 2013
b3102f7
Add explicit relative imports
Feb 12, 2013
fd35937
Use "as" for raised exceptions
Feb 12, 2013
731a1b9
Test-only change. Use int() instead of long().
Feb 12, 2013
23b20d6
A couple more unicode changes.
Feb 12, 2013
c6b85a4
cStringIO.StringIO -> io.BytesIO for py3
Feb 12, 2013
dd96eab
More print() changes for python3
Feb 12, 2013
e541ff6
Tell test to use http.server for python3
Feb 12, 2013
d8e7458
Fixed two more unicode strings
Feb 12, 2013
738e710
Import httplib or http.client as http_client
Feb 14, 2013
f24338b
String encoding fix for python3
Feb 14, 2013
942077e
urllib -> urllib.request (was causing tests to hang)
Feb 18, 2013
d444934
Use byte literal for data going down a bytes interface
Feb 18, 2013
77120c4
Mostly unicode changes, test passing
Feb 18, 2013
67ed6ca
Handle unicode -> str -> bytes rename in py3
Feb 18, 2013
23e1140
Tell test to use http.server for python3
Feb 12, 2013
aac5d5f
Use io.open over open
Feb 19, 2013
98722b3
Corrected spelling of exception. Only instance in the java code.
Feb 21, 2013
b4ed888
First batch of changes to support py2.6+ and py3.0+
Feb 6, 2013
c8ce58b
Second batch of changes for py2.6 and py3 concurrent support
Feb 7, 2013
2e64bcf
Some more changes for py2,3 compatibility
Feb 11, 2013
5968015
Rename builtin types for python 2.x
Feb 12, 2013
9ae7438
Decode strings as utf-8
Feb 12, 2013
17a5a32
Add explicit relative imports
Feb 12, 2013
cf50cfe
Use "as" for raised exceptions
Feb 12, 2013
da1e3a1
Test-only change. Use int() instead of long().
Feb 12, 2013
f859168
A couple more unicode changes.
Feb 12, 2013
c2e54ca
cStringIO.StringIO -> io.BytesIO for py3
Feb 12, 2013
bd7cbd0
More print() changes for python3
Feb 12, 2013
22e57b7
Tell test to use http.server for python3
Feb 12, 2013
b049239
Fixed two more unicode strings
Feb 12, 2013
2ed94f2
Import httplib or http.client as http_client
Feb 14, 2013
2f53f74
String encoding fix for python3
Feb 14, 2013
da93b36
urllib -> urllib.request (was causing tests to hang)
Feb 18, 2013
01c1748
Use byte literal for data going down a bytes interface
Feb 18, 2013
a04689d
Mostly unicode changes, test passing
Feb 18, 2013
9f02e56
Handle unicode -> str -> bytes rename in py3
Feb 18, 2013
2260617
Tell test to use http.server for python3
Feb 12, 2013
a7984da
Use io.open over open
Feb 19, 2013
3a00824
Merge branch 'py23' of github.com:intchanter/selenium into py23
Mar 5, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void testProtectSuccess() throws Exception {
}

@Test
public void testInterfacesProxiedProeprly() throws Exception {
public void testInterfacesProxiedProperly() throws Exception {
WebDriver actual = new PermissiveStubDriver();
final WebDriver webdriver = ThreadGuard.protect(actual);
HasTouchScreen hasTouchScreen = (HasTouchScreen) webdriver;
Expand Down
1 change: 0 additions & 1 deletion py/build.desc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ py_test(
py_env(
name = "test_env",
packages = [
"third_party/py/simplejson-2.2.1.tar.gz",
"third_party/py/py-1.4.5.zip",
"third_party/py/pytest-2.0.3.zip",
],
Expand Down
22 changes: 12 additions & 10 deletions py/docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

from __future__ import unicode_literals

import sys, os, os.path

# If extensions (or modules to document with autodoc) are in another directory,
Expand Down Expand Up @@ -41,8 +43,8 @@
master_doc = 'index'

# General information about the project.
project = u'Selenium'
copyright = u'2011, plightbo, simon.m.stewart, hbchai, jrhuggins, et al.'
project = 'Selenium'
copyright = '2011, plightbo, simon.m.stewart, hbchai, jrhuggins, et al.'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -179,8 +181,8 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'Selenium.tex', u'Selenium Documentation',
u'plightbo, simon.m.stewart, hbchai, jrhuggins, et al.', 'manual'),
('index', 'Selenium.tex', 'Selenium Documentation',
'plightbo, simon.m.stewart, hbchai, jrhuggins, et al.', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -212,18 +214,18 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'selenium', u'Selenium Documentation',
[u'plightbo, simon.m.stewart, hbchai, jrhuggins, et al.'], 1)
('index', 'selenium', 'Selenium Documentation',
['plightbo, simon.m.stewart, hbchai, jrhuggins, et al.'], 1)
]


# -- Options for Epub output ---------------------------------------------------

# Bibliographic Dublin Core info.
epub_title = u'Selenium'
epub_author = u'plightbo, simon.m.stewart, hbchai, jrhuggins, et al.'
epub_publisher = u'plightbo, simon.m.stewart, hbchai, jrhuggins, et al.'
epub_copyright = u'2011, plightbo, simon.m.stewart, hbchai, jrhuggins, et al.'
epub_title = 'Selenium'
epub_author = 'plightbo, simon.m.stewart, hbchai, jrhuggins, et al.'
epub_publisher = 'plightbo, simon.m.stewart, hbchai, jrhuggins, et al.'
epub_copyright = '2011, plightbo, simon.m.stewart, hbchai, jrhuggins, et al.'

# The language of the text. It defaults to the language option
# or en if the language is not set.
Expand Down
2 changes: 1 addition & 1 deletion py/selenium/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import exceptions
from . import exceptions
27 changes: 18 additions & 9 deletions py/selenium/selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,19 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import unicode_literals

__docformat__ = "restructuredtext en"

import httplib
import urllib
try:
import http.client as http_client
except ImportError:
import httplib as http_client

try:
import urllib.parse as urllib_parse
except ImportError:
import urllib as urllib_parse

class selenium(object):
"""
Expand Down Expand Up @@ -190,19 +199,19 @@ def start(self, browserConfigurationOptions=None, driver=None):
try:
self.sessionId = result
except ValueError:
raise Exception, result
raise Exception(result)

def stop(self):
self.do_command("testComplete", [])
self.sessionId = None

def do_command(self, verb, args):
conn = httplib.HTTPConnection(self.host, self.port)
conn = http_client.HTTPConnection(self.host, self.port)
try:
body = u'cmd=' + urllib.quote_plus(unicode(verb).encode('utf-8'))
body = 'cmd=' + urllib_parse.quote_plus(unicode(verb).encode('utf-8'))
for i in range(len(args)):
body += '&' + unicode(i+1) + '=' + \
urllib.quote_plus(unicode(args[i]).encode('utf-8'))
urllib_parse.quote_plus(unicode(args[i]).encode('utf-8'))
if (None != self.sessionId):
body += "&sessionId=" + unicode(self.sessionId)
headers = {
Expand All @@ -214,7 +223,7 @@ def do_command(self, verb, args):
response = conn.getresponse()
data = unicode(response.read(), "UTF-8")
if (not data.startswith('OK')):
raise Exception, data
raise Exception(data)
return data
finally:
conn.close()
Expand Down Expand Up @@ -263,7 +272,7 @@ def get_boolean(self, verb, args):
return True
if ("false" == boolstr):
return False
raise ValueError, "result is neither 'true' nor 'false': " + boolstr
raise ValueError("result is neither 'true' nor 'false': " + boolstr)

def get_boolean_array(self, verb, args):
boolarr = self.get_string_array(verb, args)
Expand All @@ -274,7 +283,7 @@ def get_boolean_array(self, verb, args):
if ("false" == boolstr):
boolarr[i] = False
continue
raise ValueError, "result is neither 'true' nor 'false': " + boolarr[i]
raise ValueError("result is neither 'true' nor 'false': " + boolarr[i])
return boolarr


Expand Down
24 changes: 12 additions & 12 deletions py/selenium/webdriver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from firefox.webdriver import WebDriver as Firefox
from firefox.firefox_profile import FirefoxProfile
from chrome.webdriver import WebDriver as Chrome
from chrome.options import Options as ChromeOptions
from ie.webdriver import WebDriver as Ie
from opera.webdriver import WebDriver as Opera
from phantomjs.webdriver import WebDriver as PhantomJS
from remote.webdriver import WebDriver as Remote
from common.desired_capabilities import DesiredCapabilities
from common.action_chains import ActionChains
from common.touch_actions import TouchActions
from common.proxy import Proxy
from .firefox.webdriver import WebDriver as Firefox
from .firefox.firefox_profile import FirefoxProfile
from .chrome.webdriver import WebDriver as Chrome
from .chrome.options import Options as ChromeOptions
from .ie.webdriver import WebDriver as Ie
from .opera.webdriver import WebDriver as Opera
from .phantomjs.webdriver import WebDriver as PhantomJS
from .remote.webdriver import WebDriver as Remote
from .common.desired_capabilities import DesiredCapabilities
from .common.action_chains import ActionChains
from .common.touch_actions import TouchActions
from .common.proxy import Proxy

__version__ = '2.31.0'
5 changes: 2 additions & 3 deletions py/selenium/webdriver/chrome/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
# limitations under the License.

import base64
import httplib
from selenium.webdriver.remote.command import Command
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
from selenium.common.exceptions import WebDriverException
from service import Service
from options import Options
from .service import Service
from .options import Options

class WebDriver(RemoteWebDriver):
"""
Expand Down
127 changes: 64 additions & 63 deletions py/selenium/webdriver/common/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,72 +13,73 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import unicode_literals

class Keys(object):

NULL = u'\ue000'
CANCEL = u'\ue001' # ^break
HELP = u'\ue002'
BACK_SPACE = u'\ue003'
TAB = u'\ue004'
CLEAR = u'\ue005'
RETURN = u'\ue006'
ENTER = u'\ue007'
SHIFT = u'\ue008'
LEFT_SHIFT = u'\ue008' # alias
CONTROL = u'\ue009'
LEFT_CONTROL = u'\ue009' # alias
ALT = u'\ue00a'
LEFT_ALT = u'\ue00a' # alias
PAUSE = u'\ue00b'
ESCAPE = u'\ue00c'
SPACE = u'\ue00d'
PAGE_UP = u'\ue00e'
PAGE_DOWN = u'\ue00f'
END = u'\ue010'
HOME = u'\ue011'
LEFT = u'\ue012'
ARROW_LEFT = u'\ue012' # alias
UP = u'\ue013'
ARROW_UP = u'\ue013' # alias
RIGHT = u'\ue014'
ARROW_RIGHT = u'\ue014' # alias
DOWN = u'\ue015'
ARROW_DOWN = u'\ue015' # alias
INSERT = u'\ue016'
DELETE = u'\ue017'
SEMICOLON = u'\ue018'
EQUALS = u'\ue019'
NULL = '\ue000'
CANCEL = '\ue001' # ^break
HELP = '\ue002'
BACK_SPACE = '\ue003'
TAB = '\ue004'
CLEAR = '\ue005'
RETURN = '\ue006'
ENTER = '\ue007'
SHIFT = '\ue008'
LEFT_SHIFT = '\ue008' # alias
CONTROL = '\ue009'
LEFT_CONTROL = '\ue009' # alias
ALT = '\ue00a'
LEFT_ALT = '\ue00a' # alias
PAUSE = '\ue00b'
ESCAPE = '\ue00c'
SPACE = '\ue00d'
PAGE_UP = '\ue00e'
PAGE_DOWN = '\ue00f'
END = '\ue010'
HOME = '\ue011'
LEFT = '\ue012'
ARROW_LEFT = '\ue012' # alias
UP = '\ue013'
ARROW_UP = '\ue013' # alias
RIGHT = '\ue014'
ARROW_RIGHT = '\ue014' # alias
DOWN = '\ue015'
ARROW_DOWN = '\ue015' # alias
INSERT = '\ue016'
DELETE = '\ue017'
SEMICOLON = '\ue018'
EQUALS = '\ue019'

NUMPAD0 = u'\ue01a' # numbe pad keys
NUMPAD1 = u'\ue01b'
NUMPAD2 = u'\ue01c'
NUMPAD3 = u'\ue01d'
NUMPAD4 = u'\ue01e'
NUMPAD5 = u'\ue01f'
NUMPAD6 = u'\ue020'
NUMPAD7 = u'\ue021'
NUMPAD8 = u'\ue022'
NUMPAD9 = u'\ue023'
MULTIPLY = u'\ue024'
ADD = u'\ue025'
SEPARATOR = u'\ue026'
SUBTRACT = u'\ue027'
DECIMAL = u'\ue028'
DIVIDE = u'\ue029'
NUMPAD0 = '\ue01a' # numbe pad keys
NUMPAD1 = '\ue01b'
NUMPAD2 = '\ue01c'
NUMPAD3 = '\ue01d'
NUMPAD4 = '\ue01e'
NUMPAD5 = '\ue01f'
NUMPAD6 = '\ue020'
NUMPAD7 = '\ue021'
NUMPAD8 = '\ue022'
NUMPAD9 = '\ue023'
MULTIPLY = '\ue024'
ADD = '\ue025'
SEPARATOR = '\ue026'
SUBTRACT = '\ue027'
DECIMAL = '\ue028'
DIVIDE = '\ue029'

F1 = u'\ue031' # function keys
F2 = u'\ue032'
F3 = u'\ue033'
F4 = u'\ue034'
F5 = u'\ue035'
F6 = u'\ue036'
F7 = u'\ue037'
F8 = u'\ue038'
F9 = u'\ue039'
F10 = u'\ue03a'
F11 = u'\ue03b'
F12 = u'\ue03c'
F1 = '\ue031' # function keys
F2 = '\ue032'
F3 = '\ue033'
F4 = '\ue034'
F5 = '\ue035'
F6 = '\ue036'
F7 = '\ue037'
F8 = '\ue038'
F9 = '\ue039'
F10 = '\ue03a'
F11 = '\ue03b'
F12 = '\ue03c'

META = u'\ue03d'
COMMAND = u'\ue03d'
META = '\ue03d'
COMMAND = '\ue03d'
14 changes: 7 additions & 7 deletions py/selenium/webdriver/common/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ class Proxy(object):

def __init__(self, raw=None):
if raw is not None:
if raw.has_key('proxyType') and raw['proxyType'] is not None:
if 'proxyType' in raw and raw['proxyType'] is not None:
self.proxy_type = raw['proxyType']
if raw.has_key('ftpProxy') and raw['ftpProxy'] is not None:
if 'ftpProxy' in raw and raw['ftpProxy'] is not None:
self.ftp_proxy = raw['ftpProxy']
if raw.has_key('httpProxy') and raw['httpProxy'] is not None:
if 'httpProxy' in raw and raw['httpProxy'] is not None:
self.http_proxy = raw['httpProxy']
if raw.has_key('noProxy') and raw['noProxy'] is not None:
if 'noProxy' in raw and raw['noProxy'] is not None:
self.no_proxy = raw['noProxy']
if raw.has_key('proxyAutoconfigUrl') and raw['proxyAutoconfigUrl'] is not None:
if 'proxyAutoconfigUrl' in raw and raw['proxyAutoconfigUrl'] is not None:
self.proxy_autoconfig_url = raw['proxyAutoconfigUrl']
if raw.has_key('sslProxy') and raw['sslProxy'] is not None:
if 'sslProxy' in raw and raw['sslProxy'] is not None:
self.sslProxy = raw['sslProxy']
if raw.has_key('autodetect') and raw['autodetect'] is not None:
if 'autodetect' in raw and raw['autodetect'] is not None:
self.auto_detect = raw['autodetect']

@property
Expand Down
Loading