Skip to content

Commit

Permalink
[py] fix edge webdriver init by deprecating edge_service in favor of …
Browse files Browse the repository at this point in the history
…service

also fix warnings import in edge/webdriver

Signed-off-by: Lucas Tierney <lucast1533@gmail.com>
  • Loading branch information
lmtierney committed May 29, 2019
1 parent b9830bc commit b97d398
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions py/selenium/webdriver/edge/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from selenium.webdriver.common import utils
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
from selenium.webdriver.remote.remote_connection import RemoteConnection
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from .service import Service
import warnings

from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.edge.service import Service
from selenium.webdriver.remote.remote_connection import RemoteConnection
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver

DEFAULT_PORT = 0
DEFAULT_SERVICE_LOG_PATH = None
Expand Down Expand Up @@ -64,12 +64,11 @@ def __init__(self, executable_path='MicrosoftWebDriver.exe',
DeprecationWarning, stacklevel=2)

if service:
self.edge_service = service
self.service = service
else:
self.edge_service = Service(executable_path,
port=self.port, verbose=verbose,
log_path=service_log_path)
self.edge_service.start()
self.service = Service(executable_path, port=self.port, verbose=verbose,
log_path=service_log_path)
self.service.start()

if capabilities is None:
capabilities = DesiredCapabilities.EDGE
Expand All @@ -82,6 +81,12 @@ def __init__(self, executable_path='MicrosoftWebDriver.exe',
desired_capabilities=capabilities)
self._is_remote = False

@property
def edge_service(self):
warnings.warn("'edge_service' has been deprecated, please use 'service'",
DeprecationWarning, stacklevel=2)
return self.service

def quit(self):
RemoteWebDriver.quit(self)
self.edge_service.stop()
self.service.stop()

0 comments on commit b97d398

Please sign in to comment.