Documentation

    Amazon Web Services

    Microsoft Azure

    RapidAPI

    APILayer

Last Update: 2024-03-01

Playwright on Windows


Table of Content


Launch Playwright on Windows
Connect to your VM
Run our sample code and develop your own scripts
Troubleshooting

Launch Playwright on Windows

Navigate to our listings page Playwright on Windows on Azure Marketplace.

Click on "Get it now" to initiate the launch dialog.

On the "Create a virtual machine" page, enter a username for the virtual machine (e.g., "azureuser") and a password.

Review the settings and proceed to create the virtual machine.

Connect to your instance via RDP


Please refer to the 'Launch and Configure' section above before proceeding with this part. For the RDP/VNC connection, you will need the username you created in the Azure portal, as well as the Virtual Machine ID (vmId).

Obtain the public IP address of your Virtual Machine:

Open 'Remote Desktop Connection' and connect using the public IP address of your virtual machine.

When prompted, enter the username and password you specified during the launch of the virtual machine.

Run our sample code and develop your own scripts

Connect to the instance via RDP and log in with the user you created in the Azure Portal.

Open the Command Line Interface. Navigate to the C:\Playwright\nodejs directory by entering:

cd C:\Playwright\nodejs

Run the sample code with the command:

node script.js

You can observe how the browser executes the sample script.

Note: The first execution after startup can be very slow, especially on VMs with low memory configured, as the browser may run out of memory. Performance typically improves over time. If the browser exceeds the startup limit (30 seconds), please try running the script again.

By opening the folder C:\Playwright\nodejs, you can view the screenshots that have been taken.

Edit the script by right-clicking and choosing Open with Notepad++. The script contains demo code for all available browsers in Playwright. Ensure you save the file after making any changes.

Return to the Command Prompt window and execute the modified scripts again with:

node script.js

Troubleshooting

How to Utilize the Clipboard for Copy & Paste Operations

Most RDP and VNC clients are designed to integrate with your system's clipboard, enabling straightforward copy (Ctrl+C) and paste (Ctrl+V) functionality. This feature allows you to copy text or files on one end and paste them on the other without any complex procedures.

Using "Remote Paste" Feature: Some clients offer an enhanced feature known as "remote paste." This option can usually be found within the client's settings or preferences menu. When enabled, it optimizes the process for copying content from your local system to the virtual machine, ensuring smoother and potentially faster transfers.

Steps for Effective Copy & Paste:

For Text:

  1. Select the text you wish to copy on your local machine.
  2. Press Ctrl+C to copy the text to the clipboard.
  3. Switch to your RDP or VNC client window where the virtual machine is running.
  4. Press Ctrl+V to paste the text within the virtual machine environment.

For Files:

  1. Highlight the file(s) on your local system that you want to transfer.
  2. Use Ctrl+C to copy the selected file(s).
  3. Move to the virtual machine via your RDP or VNC client.
  4. Press Ctrl+V to paste the file(s) into the desired location on the virtual machine.

Troubleshooting Tips:

Clipboard Not Working? If you encounter issues with the clipboard functionality, first ensure that clipboard sharing is enabled in your RDP/VNC client's settings. This setting is crucial for copy-paste operations to work across your local system and the virtual machine.

File Transfer Fails? Ensure that the client and virtual machine both support file transfer via clipboard. Some setups may require additional configuration or support only text copy-paste by default.

Performance Issues: For large files or slow connections, consider using dedicated file transfer protocols or services instead of clipboard operations for a more reliable and efficient transfer process.