Skip to content

Commit

Permalink
py: remove Presto-Opera support
Browse files Browse the repository at this point in the history
This removes support for Engine.PRESTO from webdriver.Opera but leaves
the API intact. A deprecation warning on the use of Engine will
probably be introduced later.
  • Loading branch information
andreastt committed Feb 28, 2015
1 parent 45afa32 commit c8725cf
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 182 deletions.
1 change: 1 addition & 0 deletions py/selenium/webdriver/opera/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2015 Software Freedom Conservancy
# Copyright 2010 WebDriver committers
# Copyright 2010 Google Inc.
#
Expand Down
78 changes: 0 additions & 78 deletions py/selenium/webdriver/opera/service.py

This file was deleted.

93 changes: 11 additions & 82 deletions py/selenium/webdriver/opera/webdriver.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
#
# Copyright 2011-2013 Sofware freedom conservancy

# Copyright 2011-2015 Sofware Freedom Conservancy
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -20,6 +20,7 @@
import httplib as http_client

import os

from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
from selenium.webdriver.chrome.webdriver import WebDriver as ChromiumDriver
Expand All @@ -28,10 +29,8 @@


class OperaDriver(ChromiumDriver):
"""
Controls the new OperaDriver and allows you
to drive the Opera browser based on Chromium.
"""
"""Controls the new OperaDriver and allows you
to drive the Opera browser based on Chromium."""

def __init__(self, executable_path=None, port=0,
opera_options=None, service_args=None,
Expand Down Expand Up @@ -65,59 +64,8 @@ def create_options(self):
return Options()


class PrestoDriver(RemoteWebDriver):
"""
Controls the OperaDriver and allows you to drive the Opera browser
based on Presto.
"""

def __init__(self, executable_path=None, port=0,
desired_capabilities=DesiredCapabilities.OPERA):
"""
Creates a new instance of the Opera driver.
Starts the service and then creates new instance of Opera Driver.
:Args:
- executable_path - path to the executable. If the default is used
it assumes the executable is in the
Environment Variable SELENIUM_SERVER_JAR
- port - port you would like the service to run, if left as 0,
a free port will be found.
- desired_capabilities: Dictionary object with desired capabilities -
may be used to provide various Opera switches.
"""
if executable_path is None:
try:
executable_path = os.environ["SELENIUM_SERVER_JAR"]
except:
raise Exception("No executable path given, please add one \
to Environment Variable 'SELENIUM_SERVER_JAR'")
self.service = Service(executable_path, port=port)
self.service.start()

RemoteWebDriver.__init__(self,
command_executor=self.service.service_url,
desired_capabilities=desired_capabilities)
self._is_remote = False

def quit(self):
"""
Closes the browser and shuts down the OperaDriver executable
that is started when starting the OperaDriver
"""
try:
RemoteWebDriver.quit(self)
except http_client.BadStatusLine:
pass
finally:
self.service.stop()


class WebDriver(PrestoDriver, OperaDriver):

class WebDriver(OperaDriver):
class ServiceType:
PRESTO = 1
CHROMIUM = 2

def __init__(self,
Expand All @@ -127,27 +75,8 @@ def __init__(self,
service_log_path=None,
service_args=None,
opera_options=None):
engine = (desired_capabilities.get('engine', None)
if desired_capabilities else None)
if (engine == WebDriver.ServiceType.CHROMIUM or
opera_options and opera_options.android_package_name):
OperaDriver.__init__(self, executable_path=executable_path,
port=port, opera_options=opera_options,
service_args=service_args,
desired_capabilities=desired_capabilities,
service_log_path=service_log_path)
else:
if service_log_path:
print("Warning! service_log_path shouldn't be used " +
"with Presto based Opera")
if service_args:
print("Warning! service_args shouldn't be used with " +
"Presto based Opera")
if opera_options:
print("Warning! opera_options shouldn't be used with " +
"Presto based Opera")
if not desired_capabilities:
desired_capabilities = DesiredCapabilities.OPERA
PrestoDriver.__init__(self, executable_path=executable_path,
port=port,
desired_capabilities=desired_capabilities)
OperaDriver.__init__(self, executable_path=executable_path,
port=port, opera_options=opera_options,
service_args=service_args,
desired_capabilities=desired_capabilities,
service_log_path=service_log_path)
27 changes: 14 additions & 13 deletions py/test/selenium/webdriver/common/alerts_tests.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#Copyright 2007-2009 WebDriver committers
#Copyright 2007-2009 Google Inc.
# Copyright 2015 Software Freedom Conservancy
# Copyright 2007-2009 WebDriver committers
# Copyright 2007-2009 Google Inc.
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#limitations under the License.
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import pytest

from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
Expand All @@ -24,9 +26,8 @@

import unittest

@pytest.mark.ignore_opera
class AlertsTest(unittest.TestCase):

class AlertsTest(unittest.TestCase):
def testShouldBeAbleToOverrideTheWindowAlertMethod(self):
self._loadPage("alerts")
self.driver.execute_script(
Expand Down
2 changes: 1 addition & 1 deletion py/test/selenium/webdriver/common/clear_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/python

# Copyright 2015 Software Freedom Conservancy
# Copyright 2008-2010 WebDriver committers
# Copyright 2008-2010 Google Inc.
#
Expand Down Expand Up @@ -41,7 +42,6 @@ def testTextInputShouldNotClearWhenDisabled(self):
except InvalidElementStateException:
pass

@pytest.mark.ignore_opera
def testTextInputShouldNotClearWhenReadOnly(self):
self._loadPage("readOnlyPage")
element = self.driver.find_element_by_id("readOnlyTextInput")
Expand Down
16 changes: 15 additions & 1 deletion py/test/selenium/webdriver/common/click_scrolling_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Copyright 2015 Sofware Freedom Conservancy
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import unittest
import pytest

from selenium.webdriver.common.by import By
from selenium.common.exceptions import MoveTargetOutOfBoundsException

Expand Down Expand Up @@ -40,7 +55,6 @@ def testShouldBeAbleToClickOnAnElementHiddenByOverflow(self):
self.assertEqual("line8", self.driver.find_element(By.ID, "clicked").text)

@pytest.mark.ignore_chrome
@pytest.mark.ignore_opera
def testShouldNotScrollOverflowElementsWhichAreVisible(self):
self._loadPage("scroll2")
list = self.driver.find_element(By.TAG_NAME, "ul")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/python

# Copyright 2015 Software Freedom Conservancy
# Copyright 2008-2010 WebDriver committers
# Copyright 2008-2010 Google Inc.
#
Expand Down Expand Up @@ -235,7 +236,6 @@ def testCanRetrieveTheCurrentValueOfATextFormField_textArea(self):
self.assertEqual("hello world", element.get_attribute("value"))

@pytest.mark.ignore_chrome
@pytest.mark.ignore_opera
def testShouldReturnNullForNonPresentBooleanAttributes(self):
self._loadPage("booleanAttributes")
element1 = self.driver.find_element_by_id("working")
Expand Down
2 changes: 1 addition & 1 deletion py/test/selenium/webdriver/common/opacity_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/python

# Copyright 2015 Software Freedom Conservancy
# Copyright 2008-2012 WebDriver committers
# Copyright 2008-2012 Google Inc.
#
Expand All @@ -25,7 +26,6 @@
class OpacityTests(unittest.TestCase):

@pytest.mark.ignore_ie
@pytest.mark.ignore_opera
def testShouldBeAbleToClickOnElementsWithOpacityZero(self):
self._loadPage("click_jacker")
element = self.driver.find_element(By.ID, "clickJacker")
Expand Down
4 changes: 1 addition & 3 deletions py/test/selenium/webdriver/common/window_switching_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/python

# Copyright 2015 Software Freedom Conservancy
# Copyright 2008-2009 WebDriver committers
# Copyright 2008-2009 Google Inc.
#
Expand Down Expand Up @@ -56,7 +57,6 @@ def testShouldThrowNoSuchWindowException(self):
self.driver.switch_to.window(current)

@pytest.mark.ignore_chrome
@pytest.mark.ignore_opera
def testShouldThrowNoSuchWindowExceptionOnAnAttemptToGetItsHandle(self):
self._loadPage("xhtmlTest")
current = self.driver.current_window_handle
Expand All @@ -74,7 +74,6 @@ def testShouldThrowNoSuchWindowExceptionOnAnAttemptToGetItsHandle(self):
self.driver.switch_to.window(current)

@pytest.mark.ignore_chrome
@pytest.mark.ignore_opera
@pytest.mark.ignore_ie
def testShouldThrowNoSuchWindowExceptionOnAnyOperationIfAWindowIsClosed(self):
self._loadPage("xhtmlTest")
Expand All @@ -100,7 +99,6 @@ def testShouldThrowNoSuchWindowExceptionOnAnyOperationIfAWindowIsClosed(self):
self.driver.switch_to.window(current)

@pytest.mark.ignore_chrome
@pytest.mark.ignore_opera
@pytest.mark.ignore_ie
def testShouldThrowNoSuchWindowExceptionOnAnyElementOperationIfAWindowIsClosed(self):
self._loadPage("xhtmlTest")
Expand Down
3 changes: 1 addition & 2 deletions py/test/selenium/webdriver/common/window_tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2015 Software Freedom Conservancy
# Copyright 2008-2009 WebDriver committers
# Copyright 2008-2009 Google Inc.
#
Expand All @@ -20,9 +21,7 @@


class WindowTests(unittest.TestCase):

@pytest.mark.ignore_chrome
@pytest.mark.ignore_opera
@pytest.mark.ignore_ie
def testShouldMaximizeTheWindow(self):
resize_timeout = 5
Expand Down

0 comments on commit c8725cf

Please sign in to comment.