fix(android): use domain socket suffix chrome can discover (#26724)
Fixes: https://github.com/microsoft/playwright/issues/26721
This commit is contained in:
Родитель
ee86b9bc94
Коммит
eb9ef64e7d
|
@ -262,13 +262,15 @@ export class AndroidDevice extends SdkObject {
|
|||
async launchBrowser(pkg: string = 'com.android.chrome', options: channels.AndroidDeviceLaunchBrowserParams): Promise<BrowserContext> {
|
||||
debug('pw:android')('Force-stopping', pkg);
|
||||
await this._backend.runCommand(`shell:am force-stop ${pkg}`);
|
||||
const socketName = isUnderTest() ? 'webview_devtools_remote_playwright_test' : ('playwright-' + createGuid());
|
||||
const socketName = isUnderTest() ? 'webview_devtools_remote_playwright_test' : ('playwright_' + createGuid() + '_devtools_remote');
|
||||
const commandLine = this._defaultArgs(options, socketName).join(' ');
|
||||
debug('pw:android')('Starting', pkg, commandLine);
|
||||
// encode commandLine to base64 to avoid issues (bash encoding) with special characters
|
||||
await this._backend.runCommand(`shell:echo "${Buffer.from(commandLine).toString('base64')}" | base64 -d > /data/local/tmp/chrome-command-line`);
|
||||
await this._backend.runCommand(`shell:am start -a android.intent.action.VIEW -d about:blank ${pkg}`);
|
||||
return await this._connectToBrowser(socketName, options);
|
||||
const browserContext = await this._connectToBrowser(socketName, options);
|
||||
await this._backend.runCommand(`shell:rm /data/local/tmp/chrome-command-line`);
|
||||
return browserContext;
|
||||
}
|
||||
|
||||
private _defaultArgs(options: channels.AndroidDeviceLaunchBrowserParams, socketName: string): string[] {
|
||||
|
|
|
@ -11,6 +11,7 @@ fi
|
|||
bash $PWD/utils/avd_stop.sh
|
||||
|
||||
echo "Starting emulator"
|
||||
# nohup ${ANDROID_HOME}/emulator/emulator -avd android33 -gpu swiftshader &
|
||||
nohup ${ANDROID_HOME}/emulator/emulator -avd android33 -no-audio -no-window -no-boot-anim -no-snapshot &
|
||||
${ANDROID_HOME}/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'
|
||||
${ANDROID_HOME}/platform-tools/adb devices
|
||||
|
|
Загрузка…
Ссылка в новой задаче