Closed jevgenijusmarinuskinas closed 2 years ago
No, unfortunately this isn't possible at the moment. I'll convert this into a feature request though, and we can explore adding it.
I have the same question and request. Playwright supports browser_channel environment variable for Python, Java, JS/TS. I am not seeing it working in dotnet. I am struggling to figure out how to run Github Actions for Chrome and MSEdge.
As a workaround, you can manually instantiate the browser instance, obviously, for example, by doing:
public class ChannelTest : PlaywrightTest
{
private IBrowser browser;
[SetUp]
public async Task SetUp()
{
browser = await Playwright.Chromium.LaunchAsync(new()
{
Headless = false,
Channel = "chrome-dev"
});
}
[Test]
public async Task ShouldUseChannel() {
var page = await browser.NewPageAsync();
var res = await page.GotoAsync("https://www.microsoft.com");
Assert.IsTrue(res.Status == 200);
}
}
You just have to understand the drawbacks in this approach, which is that a new Browser will be spun up depending on your parallelization settings. By default, we have the following in our tests:
[assembly: NUnit.Framework.Parallelizable(NUnit.Framework.ParallelScope.Fixtures)]
You need to adapt the above to the scope you've chosen & use the appropriate setup methods.
Your question
Hello,
I can specify BROWSER and HEADED through the means of environment variables, to be used with a PageTest base class in my code. I've looked through the playwright sources, and was unable to find an environment variable for a Chromium channel. Is it possible to somehow control it in this scenario (for example, by setting some property, etc.)?