Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support 'goog:loggingPrefs' value when creating a session #954

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

pujagani
Copy link
Contributor

Problem: Able to receive performance log types and get performance logs when using Mobile JSON Wire protocol but unable to do the same when using W3C.

Reason: The logging preferences are set using "goog:LoggingPrefs" in Selenium capability. "[enablePerformanceLogging](https://github.com/appium/appium-android-driver/blob/92b51340cd976a73cb60530d6cdd6d43414b939a/lib/commands/context/helpers.js#L208)" is deprecated and Selenium 4 does not allow passing it. However, the Appium Android driver did not account for it and set it correctly to pass it to the Appium Chromedriver. Thus, the ChromeDriver would not receive it and then create a default session with the default logging preferences i.e. {browser: ALL}.

Logs (when trying to use the Appium server):

Capabilities sent:

22024-08-28 14:12:36:753 - [HTTP] {"capabilities":{"firstMatch":[{"goog:chromeOptions":{"args":["--proxy-bypass-list=<-loopback>","test-type","--proxy-server=http://[REDACTED]","--disable-features=Translate"]},"newCommandTimeout":0,"goog:loggingPrefs":{"performance":"ALL"},"appium:skipServerInstallation":"true","platformName":"Android","deviceName":"android","browserName":"chrome"}]}}

Capabilities when creating a ChromeDriver session capabilities:

2024-08-28 14:12:40:644 - [AndroidDriver] Merging 'goog:chromeOptions' into 'chromeOptions'. This may cause unexpected behavior
2024-08-28 14:12:40:644 - [debug] [AndroidDriver] Before starting chromedriver, androidPackage is 'com.android.chrome'
2024-08-28 14:12:40:645 - [debug] [Chromedriver] Changed state to 'starting'
2024-08-28 14:12:40:645 - [Chromedriver] Set chromedriver binary as: /usr/local/.browserstack/deps/chromedriver/v123.0.6312.86/chromedriver
2024-08-28 14:12:40:645 - [debug] [Chromedriver] Killing any old chromedrivers, running: pkill -15 -f "/usr/local/.browserstack/deps/chromedriver/v123.0.6312.86/chromedriver.*--port=18086"
2024-08-28 14:12:40:663 - [Chromedriver] No old chromedrivers seem to exist
2024-08-28 14:12:40:663 - [debug] [Chromedriver] Cleaning any old adb forwarded port socket connections
2024-08-28 14:12:40:664 - [debug] [ADB] List forwarding ports
2024-08-28 14:12:40:664 - [debug] [ADB] Running '/usr/local/.browserstack/android-sdk/platform-tools/adb -P 5037 -s R5CT21L7E6E forward --list'
2024-08-28 14:12:40:671 - [Chromedriver] Spawning chromedriver with: /usr/local/.browserstack/deps/chromedriver/v123.0.6312.86/chromedriver --url-base=wd/hub --port=18086 --adb-port=5037 --verbose
2024-08-28 14:12:40:681 - [debug] [Chromedriver] Chromedriver version: '123.0.6312.86'
2024-08-28 14:12:40:682 - [debug] [WD Proxy] Matched '/status' to command name 'getStatus'
2024-08-28 14:12:40:682 - [debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:18086/wd/hub/status] with no body
2024-08-28 14:12:40:684 - [debug] [WD Proxy] Got response with status 200: {"value":{"build":{"version":"123.0.6312.86 (9b72c47a053648d405376c5cf07999ed626728da-refs/branch-heads/6312@{#698})"},"message":"ChromeDriver ready for new sessions.","os":{"arch":"x86_64","name":"Linux","version":"5.16.12-200.fc35.x86_64"},"ready":true}}
2024-08-28 14:12:40:684 - [Chromedriver] Starting W3C Chromedriver session with capabilities: {
2024-08-28 14:12:40:684 - [Chromedriver]   "capabilities": {
2024-08-28 14:12:40:684 - [Chromedriver]     "alwaysMatch": {
2024-08-28 14:12:40:684 - [Chromedriver]       "goog:chromeOptions": {
2024-08-28 14:12:40:684 - [Chromedriver]         "androidPackage": "com.android.chrome",
2024-08-28 14:12:40:684 - [Chromedriver]         "args": [
2024-08-28 14:12:40:684 - [Chromedriver]           "--proxy-bypass-list=<-loopback>",
2024-08-28 14:12:40:684 - [Chromedriver]           "test-type",
2024-08-28 14:12:40:684 - [Chromedriver]           "--proxy-server=http://[REDACTED]",
2024-08-28 14:12:40:684 - [Chromedriver]           "--disable-features=Translate"
2024-08-28 14:12:40:685 - [Chromedriver]         ],
2024-08-28 14:12:40:685 - [Chromedriver]         "androidDeviceSerial": "R5CT21L7E6E"
2024-08-28 14:12:40:685 - [Chromedriver]       },
2024-08-28 14:12:40:685 - [Chromedriver]       "goog:loggingPrefs": {
2024-08-28 14:12:40:685 - [Chromedriver]         "browser": "ALL"
2024-08-28 14:12:40:685 - [Chromedriver]       }
2024-08-28 14:12:40:685 - [Chromedriver]     }
2024-08-28 14:12:40:685 - [Chromedriver]   }
2024-08-28 14:12:40:685 - [Chromedriver] }

Note that the capabilities sent while creating a ChromeDriver session do not contain the logging preferences: "performance": "ALL” but only the default value "browser": "ALL". This change fixes it in the Android appium driver.

Copy link

linux-foundation-easycla bot commented Aug 29, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@mykola-mokhnach mykola-mokhnach merged commit 8392b89 into appium:master Aug 29, 2024
6 checks passed
github-actions bot pushed a commit that referenced this pull request Aug 29, 2024
## [9.9.0](v9.8.3...v9.9.0) (2024-08-29)

### Features

* support 'goog:loggingPrefs' value when creating a session ([#954](#954)) ([8392b89](8392b89))
Copy link

🎉 This issue has been resolved in version 9.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@KazuCocoa KazuCocoa added the size:S contribution size: S label Sep 6, 2024
@jlipps
Copy link
Member

jlipps commented Sep 6, 2024

Hi @pujagani, congrats, the Appium project wants to compensate you for this (and perhaps other) contribution(s) this month! Please reply to this comment mentioning me and sharing your OpenCollective account name, so that we can initiate payment! Or let me know if you decline to receive compensation via OpenCollective. Thank you!

@pujagani
Copy link
Contributor Author

Thank you so much @jlipps! OpenCollective details : https://opencollective.com/pujagani

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released size:S contribution size: S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants