diff --git a/.travis.yml b/.travis.yml index 22194fb0a..afe5886fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ before_install: - unzip chromedriver_linux64.zip - sudo chmod u+x chromedriver - sudo mv chromedriver /usr/bin/ + - pip install --upgrade pip install: - pip install . - pip install -r requirements.txt @@ -34,12 +35,12 @@ matrix: - BROWSER=chrome - SELENIUM=3.3.1 - ROBOTFRAMEWORK=2.8.7 - - python: "3.3" # For PR and cron + - python: "3.6" # For PR and cron env: - BROWSER=chrome - SELENIUM=2.53.6 - ROBOTFRAMEWORK=3.0.2 - - python: "3.3" # For cron only + - python: "3.6" # For cron only env: - BROWSER=firefox - SELENIUM=2.53.6 diff --git a/src/Selenium2Library/keywords/browsermanagement.py b/src/Selenium2Library/keywords/browsermanagement.py index edf969248..036dc8c57 100644 --- a/src/Selenium2Library/keywords/browsermanagement.py +++ b/src/Selenium2Library/keywords/browsermanagement.py @@ -625,6 +625,11 @@ def _create_remote_web_driver(self , capabilities_type , remote_url , desired_ca creates the associated remote web driver''' desired_capabilities_object = capabilities_type.copy() + + try: + unicode # Python 2 + except NameError: + unicode = str # Python 3 if type(desired_capabilities) in (str, unicode): desired_capabilities = self._parse_capabilities_string(desired_capabilities) diff --git a/src/Selenium2Library/keywords/element.py b/src/Selenium2Library/keywords/element.py index 3c6bf57f3..8e2c9b326 100644 --- a/src/Selenium2Library/keywords/element.py +++ b/src/Selenium2Library/keywords/element.py @@ -8,6 +8,10 @@ from .keywordgroup import KeywordGroup +try: + basestring # Python 2 +except NameError: + basestring = str # Python 3 class ElementKeywords(KeywordGroup): diff --git a/src/Selenium2Library/locators/customlocator.py b/src/Selenium2Library/locators/customlocator.py index 6f68752d7..6c81d43e6 100644 --- a/src/Selenium2Library/locators/customlocator.py +++ b/src/Selenium2Library/locators/customlocator.py @@ -1,5 +1,10 @@ from robot.libraries.BuiltIn import BuiltIn +try: + basestring # Python 2 +except NameError: + basestring = str # Python 3 + class CustomLocator(object): diff --git a/src/Selenium2Library/utils/__init__.py b/src/Selenium2Library/utils/__init__.py index f43c24c57..092c83fd8 100644 --- a/src/Selenium2Library/utils/__init__.py +++ b/src/Selenium2Library/utils/__init__.py @@ -4,7 +4,10 @@ def escape_xpath_value(value): - value = unicode(value) + try: + value = unicode(value) # Python 2 + except NameError: + pass # Python 3 if '"' in value and '\'' in value: parts_wo_apos = value.split('\'') return "concat('%s')" % "', \"'\", '".join(parts_wo_apos)