Closed DudaGod closed 11 months ago
What we should do is move the _launchWithSeleniumHub out into the userland or into the fixture layer. That way you would have the control over the wiring of Playwright and Selenium together.
What we should do is move the _launchWithSeleniumHub out into the userland or into the fixture layer. That way you would have the control over the wiring of Playwright and Selenium together.
That sounds good. Of course, it would be more convenient not to write the same logic from _launchWithSeleniumHub
by yourself, but I remember that you don't really want to support remote launch because Selenium can remove support CDP at any time.
Having access to override public _launchWithSeleniumHub
or use fixture will I be able to implement a connection via w3c protocol to any desired browser? For example we have android emulators on linux containers in which we test chrome and native applications. Or iOS simulators on mac mini in which we test safari.
They don't support CDP and it means that I should implement commands using w3c.
That sounds good. Of course, it would be more convenient not to write the same logic from _launchWithSeleniumHub by yourself, but I remember that you don't really want to support remote launch because Selenium can remove support CDP at any time.
Yes, as discussed, you should move this code into your own fixture.
They don't support CDP and it means that I should implement commands using w3c.
If you want to run Playwright against non-CDP, you need to implement pretty much entirely new browser flavor. This is not something we would take on or recommend doing to you.
Why you close it? Based on you propolsal, I concluded that it is necessary to make the _launchWithSeleniumHub
method public and available from browser
for example. Like this:
import { test as base } from '@playwright/test';
const test = base.extend({
browser: [async ({browser}, use) => {
browser.launchWithSeleniumHub = () => {
console.log('my implementation');
};
await use(browser);
}, {scope: 'worker'}],
})
Yes, as discussed, you should move this code into your own fixture.
I can do it, but I don't want to use private methods which can be renamed/removed/etc at any time.
Hello.
I use playwright with browsers from remote cloud (based on selenoid). These browsers save log to the file with session id (available by url to cloud with passed session id). I want to display session id in html report attachments. The problem is that I don't have access to this value, which is inited here - https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/chromium/chromium.ts#L209C46-L210.
I connect to my browsers using fixture and I want to use it to get
sessionId
. So I want users just connect this fixture and don't think about anything else.I see the following solutions:
sessionId
. I don't like it because It means that user should always enable debug logTarget.attachedToTarget
event. Not accessible from outside_launchWithSeleniumHub
in my fixtre. Example:const test = base.extend({ playwright: [async ({playwright}, use) => { const playwrightImpl = playwright._toImpl(playwright);
})
test('test page', async ({page}) => { await page.goto('about:blank'); });