Skip to content

Commit 3321f54

Browse files
author
AutomatedTester
committed
Stop accessing variables directly and go through a property
1 parent 79afa18 commit 3321f54

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

py/selenium/webdriver/remote/webdriver.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def __init__(self, command_executor='http://127.0.0.1:4444/wd/hub',
7070
self.error_handler = ErrorHandler()
7171
self.start_client()
7272
self.start_session(desired_capabilities, browser_profile)
73-
self.switch_to = SwitchTo(self)
73+
self._switch_to = SwitchTo(self)
7474

7575
@property
7676
def name(self):
@@ -483,36 +483,40 @@ def maximize_window(self):
483483
"""
484484
self.execute(Command.MAXIMIZE_WINDOW, {"windowHandle": "current"})
485485

486+
@property
487+
def switch_to(self):
488+
return self._switch_to
489+
486490
#Target Locators
487491
def switch_to_active_element(self):
488492
""" Deprecated use driver.switch_to.active_element
489493
"""
490494
warnings.warn("use driver.switch_to.active_element instead", DeprecationWarning)
491-
return self.switch_to.active_element
495+
return self._switch_to.active_element
492496

493497
def switch_to_window(self, window_name):
494498
""" Deprecated use driver.switch_to.window
495499
"""
496500
warnings.warn("use driver.switch_to.window instead", DeprecationWarning)
497-
self.switch_to.window(window_name)
501+
self._switch_to.window(window_name)
498502

499503
def switch_to_frame(self, frame_reference):
500504
""" Deprecated use driver.switch_to.frame
501505
"""
502506
warnings.warn("use driver.switch_to.frame instead", DeprecationWarning)
503-
self.switch_to.frame(frame_reference)
507+
self._switch_to.frame(frame_reference)
504508

505509
def switch_to_default_content(self):
506510
""" Deprecated use driver.switch_to.default_content
507511
"""
508512
warnings.warn("use driver.switch_to.default_content instead", DeprecationWarning)
509-
self.switch_to.default_content()
513+
self._switch_to.default_content()
510514

511515
def switch_to_alert(self):
512516
""" Deprecated use driver.switch_to.alert
513517
"""
514518
warnings.warn("use driver.switch_to.alert instead", DeprecationWarning)
515-
return self.switch_to.alert
519+
return self._switch_to.alert
516520

517521
#Navigation
518522
def back(self):

0 commit comments

Comments
 (0)