How to download PDF while executing automated test case using playwright

I am executing my playwright test cases on LambdaTest platform. I have a test case in which I need to download a pdf file. When I run the test case on my local machine I am able to download the pdf as while launching the chrome browser on local i am setting:

defaultPreferences = {
					plugins: {
						always_open_pdf_externally: true,
					}

On lambdatest I dont see any such option while connecting to browser and hence instead file getting downloaded it is displayed in Chrome’s internal pdf viewer.

Below are the setting which I am using for launching the chrome on LambdaTest:

const capabilities = {
			browserName: `${LTBrowser}`,
			browserVersion: "latest",
			"LT:Options": {
				platform: `${process.env.OPERATING_SYSTEM}`,
				build: "IPAT",
				name: `${this.tcName}`,
				tags: [`${this.tag}`],
				user: `${process.env.USER_ID}`,
				accessKey: `${process.env.ACCESS_KEY}`,
				network: network_option,
				video: video_option,
				console: console_option,
				visual: visual_option,
				resolution: `${process.env.RESOLUTION}`,
				idleTimeout: Number(`${process.env.IDLE_TIMEOUT}`),
				browserVersion: "latest",
			},
		}
		const browserInstance = await chromium.connect({
			wsEndpoint: `wss://cdp.lambdatest.com/playwright?capabilities=${encodeURIComponent(
				JSON.stringify(capabilities)
			)}`,
		})

Can anyone please let me know how I can enable the pdf download?

Any workaround for the above mentioned issue?

Hello Vipin,

The way to solve this problem is to use click param modifiers with Alt , just like below:

ele.click(modifiers=["Alt", ]) .

Please give it a try and feel free to reach us out for any further queries.