1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- from selenium .common .exceptions import UnknownMethodException
1615from typing_extensions import Self
1716
1817from appium .protocols .webdriver .can_execute_commands import CanExecuteCommands
1918from appium .protocols .webdriver .can_execute_scripts import CanExecuteScripts
2019from appium .protocols .webdriver .can_remember_extension_presence import CanRememberExtensionPresence
21- from appium .webdriver .mobilecommand import MobileCommand as Command
2220
2321
2422class Common (CanExecuteCommands , CanExecuteScripts , CanRememberExtensionPresence ):
@@ -28,32 +26,13 @@ def open_notifications(self) -> Self:
2826 Returns:
2927 Union['WebDriver', 'Common']: Self instance
3028 """
31- ext_name = 'mobile: openNotifications'
32- try :
33- self .assert_extension_exists (ext_name ).execute_script (ext_name )
34- except UnknownMethodException :
35- # TODO: Remove the fallback
36- self .mark_extension_absence (ext_name ).execute (Command .OPEN_NOTIFICATIONS , {})
29+ self .execute_script ('mobile: openNotifications' )
3730 return self
3831
3932 @property
4033 def current_package (self ) -> str :
4134 """Retrieves the current package running on the device."""
42- ext_name = 'mobile: getCurrentPackage'
43- try :
44- return self .assert_extension_exists (ext_name ).execute_script (ext_name )
45- except UnknownMethodException :
46- # TODO: Remove the fallback
47- return self .mark_extension_absence (ext_name ).execute (Command .GET_CURRENT_PACKAGE )['value' ]
35+ return self .execute_script ('mobile: getCurrentPackage' )
4836
4937 def _add_commands (self ) -> None :
50- self .command_executor .add_command (
51- Command .GET_CURRENT_PACKAGE ,
52- 'GET' ,
53- '/session/$sessionId/appium/device/current_package' ,
54- )
55- self .command_executor .add_command (
56- Command .OPEN_NOTIFICATIONS ,
57- 'POST' ,
58- '/session/$sessionId/appium/device/open_notifications' ,
59- )
38+ pass
0 commit comments