Skip to content

Commit c8725cf

Browse files
committed
py: remove Presto-Opera support
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.
1 parent 45afa32 commit c8725cf

10 files changed

+46
-182
lines changed

py/selenium/webdriver/opera/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Copyright 2015 Software Freedom Conservancy
12
# Copyright 2010 WebDriver committers
23
# Copyright 2010 Google Inc.
34
#

py/selenium/webdriver/opera/service.py

-78
This file was deleted.
+11-82
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python
2-
#
3-
# Copyright 2011-2013 Sofware freedom conservancy
2+
3+
# Copyright 2011-2015 Sofware Freedom Conservancy
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
2020
import httplib as http_client
2121

2222
import os
23+
2324
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
2425
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
2526
from selenium.webdriver.chrome.webdriver import WebDriver as ChromiumDriver
@@ -28,10 +29,8 @@
2829

2930

3031
class OperaDriver(ChromiumDriver):
31-
"""
32-
Controls the new OperaDriver and allows you
33-
to drive the Opera browser based on Chromium.
34-
"""
32+
"""Controls the new OperaDriver and allows you
33+
to drive the Opera browser based on Chromium."""
3534

3635
def __init__(self, executable_path=None, port=0,
3736
opera_options=None, service_args=None,
@@ -65,59 +64,8 @@ def create_options(self):
6564
return Options()
6665

6766

68-
class PrestoDriver(RemoteWebDriver):
69-
"""
70-
Controls the OperaDriver and allows you to drive the Opera browser
71-
based on Presto.
72-
"""
73-
74-
def __init__(self, executable_path=None, port=0,
75-
desired_capabilities=DesiredCapabilities.OPERA):
76-
"""
77-
Creates a new instance of the Opera driver.
78-
79-
Starts the service and then creates new instance of Opera Driver.
80-
81-
:Args:
82-
- executable_path - path to the executable. If the default is used
83-
it assumes the executable is in the
84-
Environment Variable SELENIUM_SERVER_JAR
85-
- port - port you would like the service to run, if left as 0,
86-
a free port will be found.
87-
- desired_capabilities: Dictionary object with desired capabilities -
88-
may be used to provide various Opera switches.
89-
"""
90-
if executable_path is None:
91-
try:
92-
executable_path = os.environ["SELENIUM_SERVER_JAR"]
93-
except:
94-
raise Exception("No executable path given, please add one \
95-
to Environment Variable 'SELENIUM_SERVER_JAR'")
96-
self.service = Service(executable_path, port=port)
97-
self.service.start()
98-
99-
RemoteWebDriver.__init__(self,
100-
command_executor=self.service.service_url,
101-
desired_capabilities=desired_capabilities)
102-
self._is_remote = False
103-
104-
def quit(self):
105-
"""
106-
Closes the browser and shuts down the OperaDriver executable
107-
that is started when starting the OperaDriver
108-
"""
109-
try:
110-
RemoteWebDriver.quit(self)
111-
except http_client.BadStatusLine:
112-
pass
113-
finally:
114-
self.service.stop()
115-
116-
117-
class WebDriver(PrestoDriver, OperaDriver):
118-
67+
class WebDriver(OperaDriver):
11968
class ServiceType:
120-
PRESTO = 1
12169
CHROMIUM = 2
12270

12371
def __init__(self,
@@ -127,27 +75,8 @@ def __init__(self,
12775
service_log_path=None,
12876
service_args=None,
12977
opera_options=None):
130-
engine = (desired_capabilities.get('engine', None)
131-
if desired_capabilities else None)
132-
if (engine == WebDriver.ServiceType.CHROMIUM or
133-
opera_options and opera_options.android_package_name):
134-
OperaDriver.__init__(self, executable_path=executable_path,
135-
port=port, opera_options=opera_options,
136-
service_args=service_args,
137-
desired_capabilities=desired_capabilities,
138-
service_log_path=service_log_path)
139-
else:
140-
if service_log_path:
141-
print("Warning! service_log_path shouldn't be used " +
142-
"with Presto based Opera")
143-
if service_args:
144-
print("Warning! service_args shouldn't be used with " +
145-
"Presto based Opera")
146-
if opera_options:
147-
print("Warning! opera_options shouldn't be used with " +
148-
"Presto based Opera")
149-
if not desired_capabilities:
150-
desired_capabilities = DesiredCapabilities.OPERA
151-
PrestoDriver.__init__(self, executable_path=executable_path,
152-
port=port,
153-
desired_capabilities=desired_capabilities)
78+
OperaDriver.__init__(self, executable_path=executable_path,
79+
port=port, opera_options=opera_options,
80+
service_args=service_args,
81+
desired_capabilities=desired_capabilities,
82+
service_log_path=service_log_path)

py/test/selenium/webdriver/common/alerts_tests.py

+14-13
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
#Copyright 2007-2009 WebDriver committers
2-
#Copyright 2007-2009 Google Inc.
1+
# Copyright 2015 Software Freedom Conservancy
2+
# Copyright 2007-2009 WebDriver committers
3+
# Copyright 2007-2009 Google Inc.
34
#
4-
#Licensed under the Apache License, Version 2.0 (the "License");
5-
#you may not use this file except in compliance with the License.
6-
#You may obtain a copy of the License at
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
78
#
8-
# http://www.apache.org/licenses/LICENSE-2.0
9+
# http://www.apache.org/licenses/LICENSE-2.0
910
#
10-
#Unless required by applicable law or agreed to in writing, software
11-
#distributed under the License is distributed on an "AS IS" BASIS,
12-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
#See the License for the specific language governing permissions and
14-
#limitations under the License.
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
1516

1617
import pytest
18+
1719
from selenium.webdriver.common.by import By
1820
from selenium.webdriver.support import expected_conditions as EC
1921
from selenium.webdriver.support.wait import WebDriverWait
@@ -24,9 +26,8 @@
2426

2527
import unittest
2628

27-
@pytest.mark.ignore_opera
28-
class AlertsTest(unittest.TestCase):
2929

30+
class AlertsTest(unittest.TestCase):
3031
def testShouldBeAbleToOverrideTheWindowAlertMethod(self):
3132
self._loadPage("alerts")
3233
self.driver.execute_script(

py/test/selenium/webdriver/common/clear_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/python
22

3+
# Copyright 2015 Software Freedom Conservancy
34
# Copyright 2008-2010 WebDriver committers
45
# Copyright 2008-2010 Google Inc.
56
#
@@ -41,7 +42,6 @@ def testTextInputShouldNotClearWhenDisabled(self):
4142
except InvalidElementStateException:
4243
pass
4344

44-
@pytest.mark.ignore_opera
4545
def testTextInputShouldNotClearWhenReadOnly(self):
4646
self._loadPage("readOnlyPage")
4747
element = self.driver.find_element_by_id("readOnlyTextInput")

py/test/selenium/webdriver/common/click_scrolling_tests.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
1+
# Copyright 2015 Sofware Freedom Conservancy
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
import unittest
216
import pytest
17+
318
from selenium.webdriver.common.by import By
419
from selenium.common.exceptions import MoveTargetOutOfBoundsException
520

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

4257
@pytest.mark.ignore_chrome
43-
@pytest.mark.ignore_opera
4458
def testShouldNotScrollOverflowElementsWhichAreVisible(self):
4559
self._loadPage("scroll2")
4660
list = self.driver.find_element(By.TAG_NAME, "ul")

py/test/selenium/webdriver/common/element_attribute_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/python
22

3+
# Copyright 2015 Software Freedom Conservancy
34
# Copyright 2008-2010 WebDriver committers
45
# Copyright 2008-2010 Google Inc.
56
#
@@ -235,7 +236,6 @@ def testCanRetrieveTheCurrentValueOfATextFormField_textArea(self):
235236
self.assertEqual("hello world", element.get_attribute("value"))
236237

237238
@pytest.mark.ignore_chrome
238-
@pytest.mark.ignore_opera
239239
def testShouldReturnNullForNonPresentBooleanAttributes(self):
240240
self._loadPage("booleanAttributes")
241241
element1 = self.driver.find_element_by_id("working")

py/test/selenium/webdriver/common/opacity_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/python
22

3+
# Copyright 2015 Software Freedom Conservancy
34
# Copyright 2008-2012 WebDriver committers
45
# Copyright 2008-2012 Google Inc.
56
#
@@ -25,7 +26,6 @@
2526
class OpacityTests(unittest.TestCase):
2627

2728
@pytest.mark.ignore_ie
28-
@pytest.mark.ignore_opera
2929
def testShouldBeAbleToClickOnElementsWithOpacityZero(self):
3030
self._loadPage("click_jacker")
3131
element = self.driver.find_element(By.ID, "clickJacker")

py/test/selenium/webdriver/common/window_switching_tests.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/python
22

3+
# Copyright 2015 Software Freedom Conservancy
34
# Copyright 2008-2009 WebDriver committers
45
# Copyright 2008-2009 Google Inc.
56
#
@@ -56,7 +57,6 @@ def testShouldThrowNoSuchWindowException(self):
5657
self.driver.switch_to.window(current)
5758

5859
@pytest.mark.ignore_chrome
59-
@pytest.mark.ignore_opera
6060
def testShouldThrowNoSuchWindowExceptionOnAnAttemptToGetItsHandle(self):
6161
self._loadPage("xhtmlTest")
6262
current = self.driver.current_window_handle
@@ -74,7 +74,6 @@ def testShouldThrowNoSuchWindowExceptionOnAnAttemptToGetItsHandle(self):
7474
self.driver.switch_to.window(current)
7575

7676
@pytest.mark.ignore_chrome
77-
@pytest.mark.ignore_opera
7877
@pytest.mark.ignore_ie
7978
def testShouldThrowNoSuchWindowExceptionOnAnyOperationIfAWindowIsClosed(self):
8079
self._loadPage("xhtmlTest")
@@ -100,7 +99,6 @@ def testShouldThrowNoSuchWindowExceptionOnAnyOperationIfAWindowIsClosed(self):
10099
self.driver.switch_to.window(current)
101100

102101
@pytest.mark.ignore_chrome
103-
@pytest.mark.ignore_opera
104102
@pytest.mark.ignore_ie
105103
def testShouldThrowNoSuchWindowExceptionOnAnyElementOperationIfAWindowIsClosed(self):
106104
self._loadPage("xhtmlTest")

py/test/selenium/webdriver/common/window_tests.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Copyright 2015 Software Freedom Conservancy
12
# Copyright 2008-2009 WebDriver committers
23
# Copyright 2008-2009 Google Inc.
34
#
@@ -20,9 +21,7 @@
2021

2122

2223
class WindowTests(unittest.TestCase):
23-
2424
@pytest.mark.ignore_chrome
25-
@pytest.mark.ignore_opera
2625
@pytest.mark.ignore_ie
2726
def testShouldMaximizeTheWindow(self):
2827
resize_timeout = 5

0 commit comments

Comments
 (0)