MCPcopy Index your code
hub / github.com/appium/python-client / test_bidi_log

Function test_bidi_log

test/functional/android/bidi_tests.py:73–90  ·  view source on GitHub ↗

Test BiDi logging functionality with Chrome driver.

(driver: 'WebDriver')

Source from the content-addressed store, hash-verified

71
72@pytest.mark.skipif(is_ci(), reason='Flaky on CI')
73def test_bidi_log(driver: 'WebDriver') -> None:
74 """Test BiDi logging functionality with Chrome driver."""
75 log_entries = []
76 bidi_log_param = {'events': ['log.entryAdded'], 'contexts': ['NATIVE_APP']}
77
78 driver.script.conn.execute(command_builder('session.subscribe', bidi_log_param))
79
80 def _log(entry: AppiumLogEntry):
81 # e.g. {'type': 'syslog', 'level': 'info', 'source': {'realm': ''}, 'text': '08-05 13:30:32.617 29677 29709 I appium : channel read: GET /session/d7c38859-8930-4eb0-960a-8f917c9e6a38/source', 'timestamp': 1754368241565}
82 log_entries.append(entry.json)
83
84 try:
85 callback_id = driver.script.conn.add_callback(AppiumLogEntry, _log)
86 driver.page_source
87 assert len(log_entries) != 0
88 driver.script.conn.remove_callback(AppiumLogEntry, callback_id)
89 finally:
90 driver.script.conn.execute(command_builder('session.unsubscribe', bidi_log_param))

Callers

nothing calls this directly

Calls 1

executeMethod · 0.45

Tested by

no test coverage detected