Skip to content

Commit 9e27a99

Browse files
chore(deps): bump selenium from 4.31.0 to 4.32.0 (#1124)
* chore(deps): bump selenium from 4.31.0 to 4.32.0 Bumps [selenium](https://github.com/SeleniumHQ/Selenium) from 4.31.0 to 4.32.0. - [Release notes](https://github.com/SeleniumHQ/Selenium/releases) - [Commits](SeleniumHQ/selenium@selenium-4.31.0...selenium-4.32.0) --- updated-dependencies: - dependency-name: selenium dependency-version: 4.32.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * add logs here --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kazuaki Matsuo <[email protected]>
1 parent 9e42c7f commit 9e27a99

File tree

4 files changed

+58
-9
lines changed

4 files changed

+58
-9
lines changed

Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ tox = "~=4.25"
1515
types-python-dateutil = "~=2.9"
1616

1717
[packages]
18-
selenium = "==4.31.0"
18+
selenium = "==4.32.0"
1919
typing-extensions = "~=4.13.2"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env python
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+
15+
from typing import Any, Dict, List
16+
17+
from appium.protocols.webdriver.can_execute_commands import CanExecuteCommands
18+
19+
from ..mobilecommand import MobileCommand as Command
20+
21+
22+
class Logs(CanExecuteCommands):
23+
@property
24+
def log_types(self) -> List[str]:
25+
"""Gets a list of the available log types. This only works with w3c
26+
compliant browsers.
27+
28+
Example:
29+
--------
30+
>>> driver.log_types
31+
"""
32+
return self.execute(Command.GET_AVAILABLE_LOG_TYPES)['value']
33+
34+
def get_log(self, log_type: str) -> List[Dict[str, Any]]:
35+
"""Gets the log for a given log type.
36+
37+
Parameters:
38+
----------
39+
log_type : str
40+
- Type of log that which will be returned
41+
42+
Example:
43+
--------
44+
>>> driver.get_log('browser')
45+
>>> driver.get_log('driver')
46+
>>> driver.get_log('client')
47+
>>> driver.get_log('server')
48+
"""
49+
return self.execute(Command.GET_LOG, {'type': log_type})['value']
50+
51+
def _add_commands(self) -> None:
52+
self.command_executor.add_command(Command.GET_LOG, 'POST', '/session/$sessionId/se/log')
53+
self.command_executor.add_command(Command.GET_AVAILABLE_LOG_TYPES, 'GET', '/session/$sessionId/se/log/types')

appium/webdriver/webdriver.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
from .extensions.keyboard import Keyboard
5555
from .extensions.location import Location
5656
from .extensions.log_event import LogEvent
57+
from .extensions.logs import Logs
5758
from .extensions.remote_fs import RemoteFS
5859
from .extensions.screen_record import ScreenRecord
5960
from .extensions.session import Session
@@ -213,6 +214,7 @@ class WebDriver(
213214
Keyboard,
214215
Location,
215216
LogEvent,
217+
Logs,
216218
Network,
217219
Performance,
218220
Power,
@@ -467,9 +469,3 @@ def _add_commands(self) -> None:
467469

468470
self.command_executor.add_command(Command.GET_SCREEN_ORIENTATION, 'GET', '/session/$sessionId/orientation')
469471
self.command_executor.add_command(Command.SET_SCREEN_ORIENTATION, 'POST', '/session/$sessionId/orientation')
470-
471-
# override for Appium 1.x
472-
# Appium 2.0 and Appium 1.22 work with `/se/log` and `/se/log/types`
473-
# FIXME: remove after a while
474-
self.command_executor.add_command(Command.GET_LOG, 'POST', '/session/$sessionId/log')
475-
self.command_executor.add_command(Command.GET_AVAILABLE_LOG_TYPES, 'GET', '/session/$sessionId/log/types')

test/unit/webdriver/log_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_get_log_types():
2424
driver = ios_w3c_driver()
2525
httpretty.register_uri(
2626
httpretty.GET,
27-
appium_command('/session/1234567890/log/types'),
27+
appium_command('/session/1234567890/se/log/types'),
2828
body=json.dumps({'value': ['syslog']}),
2929
)
3030
log_types = driver.log_types
@@ -36,7 +36,7 @@ def test_get_log():
3636
driver = ios_w3c_driver()
3737
httpretty.register_uri(
3838
httpretty.POST,
39-
appium_command('/session/1234567890/log'),
39+
appium_command('/session/1234567890/se/log'),
4040
body=json.dumps({'value': ['logs as array']}),
4141
)
4242
log_types = driver.get_log('syslog')

0 commit comments

Comments
 (0)