-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
fix(recorder): Locator picker had wrong initial language in language bindings #27706
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any chance for a test?
Signed-off-by: Max Schmitt <max@schmitt.mx>
This comment has been minimized.
This comment has been minimized.
Test results for "tests 1"9 flaky25926 passed, 603 skipped Merge workflow run. |
Nice, that worked :) But still not 100% correctly, if I do Locator("<some_xpath_selector1>").Locator("<some_xpath_selector2>") I had to put xpath= in front of it, so when having it like this, it works just fine, but shouldn't be required :) |
This gets addressed in #27742. |
…bindings (microsoft#27706) **Description** When a language port was using Inspector with the "Locator Picker" feature, it only recognised JavaScript as a language by default. As a workaround the user was able to click record, interact with the page and then the language would be correctly used -> csharp e.g. would work in the "Locator Picker". **Why?** Our language bindings are setting `PW_LANG_NAME=<sdkLanguage>` env var -> good. Our recorder harness also uses this along its internal state here: https://github.com/microsoft/playwright/blob/b9b289b6415515b1b8e1a2524ed6425c8992af5a/packages/playwright-core/src/server/recorder.ts#L369 and it gets used here (no parameter means: we use the first language aka. primary language): https://github.com/microsoft/playwright/blob/b9b289b6415515b1b8e1a2524ed6425c8992af5a/packages/playwright-core/src/server/recorder.ts#L95 The only issue is that the Inspector frontend in the beginning does not know which language it should use and pass over to the server side, it then falls back to JavaScript. **Proposed fix** Instead of passing it over from the frontend to the server side, we just always use it from the server side, aka. "currentLanguage". When the user switches languages in the frontend, "currentLanguage" already gets updated properly via the "fileChanged" event. microsoft/playwright-dotnet#2718 --------- Signed-off-by: Max Schmitt <max@schmitt.mx>
Description
When a language port was using Inspector with the "Locator Picker" feature, it only recognised JavaScript as a language by default. As a workaround the user was able to click record, interact with the page and then the language would be correctly used -> csharp e.g. would work in the "Locator Picker".
Why?
Our language bindings are setting
PW_LANG_NAME=<sdkLanguage>
env var -> good. Our recorder harness also uses this along its internal state here:playwright/packages/playwright-core/src/server/recorder.ts
Line 369 in b9b289b
and it gets used here (no parameter means: we use the first language aka. primary language):
playwright/packages/playwright-core/src/server/recorder.ts
Line 95 in b9b289b
The only issue is that the Inspector frontend in the beginning does not know which language it should use and pass over to the server side, it then falls back to JavaScript.
Proposed fix
Instead of passing it over from the frontend to the server side, we just always use it from the server side, aka. "currentLanguage". When the user switches languages in the frontend, "currentLanguage" already gets updated properly via the "fileChanged" event.
microsoft/playwright-dotnet#2718