I've been a manual qa tester for a fintech company for a year or so, I want to transition to automation and watching your videos will be a great start, thank you so much. I will binge watch your videos lol.
You have heard my heart ,we started using this for our application recently and first thing I did is searching ur videos.Good that you started thank you so much
First search for playwright and I found you I am a manual tester and my company is switching to automation and this is what they are planning to use . I hope this will help me achieve my goals. Thank you
Fan ho gaya mai 🙏.... You covered so many topics and varaiety of tools with indepth skills. After following detailed steps we are able to do practically........ Jai ho Mordern time GURU 🙏
Thankyou so much sir. Your videos gave me confidence to learn automation. I was scared to begin because of fear of coding but i started learning because of your videos. 🙂
Yrr. This Hello this is raghav is like every where. Whenever I try to learn any new framework. I'm scared if I would get want familiar trainer but now I shouldn't after seeing you on playwright. Good to see you working so hard
Hi Raghav I was a manual functional tester with 7 years experience and 6 years of career break. Now i have got an opportunity to work on a project as a part of recruitment process. It includes automation testing in playwright. I am just starting to learn automation and hoping to complete the project. If you can provide any one-to-one guidance as i learn that will help me a lot. Please respond. This job will be a great leap in restarting my career.
Hi You can check all sessions here automationstepbystep.com/ Apart from this there is no live or 1-to-1 sessions. You can always ask your ques in comments All the best
Hi Sir, this is amazing - one request, when you say you can take screenshot to remember the stuff, can you please hide yourself from the screen for a sec so we can take the screenshot with ease😅and you are awesome tutor, thank you!
Hello, First I would like to thank you for your work because you help people to be more efficient in their work, which is highly commendable. THANK YOU. Second I would like to ask... Does Playwright can fill a web formulary getting data from a csv file or Excel file? I am more interested getting data from Excel or Calc (LibreOffice) files to fill web formularies. Are you going to make a video about this interesting point? This is a good subject for those who want to save time doing a tedious work. Please think about it. I suggest to do it or talk about that point. You will help many people to be more efficient. Many thanks
Hi Joey, Yes, Playwright can fill a web formulary by getting data from a CSV file, Excel file, or other data sources. You can use the Playwright API to read data from CSV or Excel files and then populate the web form fields with the data. Here's an example of how you can read data from an Excel file using the xlsx package and then use it to fill in a web form using Playwright: const xlsx = require('xlsx'); const { chromium } = require('playwright'); (async () => { // Load data from Excel file const workbook = xlsx.readFile('data.xlsx'); const worksheet = workbook.Sheets['Sheet1']; const data = xlsx.utils.sheet_to_json(worksheet); // Launch a browser const browser = await chromium.launch(); const context = await browser.newContext(); // Navigate to a web page with a form const page = await context.newPage(); await page.goto('www.example.com/form'); // Fill in the form with data from the Excel file for (let i = 0; i < data.length; i++) { const row = data[i]; await page.fill('#input1', row['Field1']); await page.fill('#input2', row['Field2']); await page.fill('#input3', row['Field3']); await page.click('#submit-button'); await page.waitForNavigation(); } // Close the browser await browser.close(); })(); In this example, the xlsx package is used to read data from an Excel file named data.xlsx. The worksheet variable contains the data from the Sheet1 worksheet in the Excel file. The sheet_to_json method is used to convert the worksheet data into a JSON object. The Playwright API is then used to launch a Chromium browser, navigate to a web page with a form, and fill in the form fields with data from the Excel file. The fill method is used to populate the form fields, and the click method is used to submit the form. The waitForNavigation method is used to wait for the page to reload after the form is submitted. Finally, the browser is closed using the close method. You can modify this code to read data from a CSV file or other data sources as needed.
Hi Rgahav sir, can you please do a more descriptive video which briefly explains point by point on How to Become a Automation Tester roadmap please? It will help a lot for manual testers like me, freshers and Non-IT background people too.
Punit That's great! Having experience in both automation testing and Node.js backend development makes you a valuable candidate. Let's explore some steps to enhance your job search: 1. Update Your Resume: - Ensure your resume highlights your relevant skills, experience, and achievements. - Mention your proficiency in automation testing tools (such as Selenium, Cypress, or JUnit) and your experience with Node.js. 2. Job Portals and Networking: - Post your resume on job portals like LinkedIn, Indeed, Glassdoor, and Naukri. - Connect with professionals in your field on LinkedIn and attend networking events. 3. Customize Applications: - Tailor your applications to each job description. Highlight specific skills that match the job requirements. - Emphasize your experience in automation testing and Node.js development. 4. GitHub and Personal Projects: - Showcase your skills by contributing to open-source projects on GitHub. - Create personal projects related to automation testing or Node.js and share them on your portfolio. 5. Certifications: - Consider obtaining relevant certifications. For automation testing, certifications like ISTQB or Selenium WebDriver can add value. - Node.js certifications (such as Node.js Certified Developer) can also boost your profile. 6. Prepare for Interviews: - Be ready to discuss your experience, problem-solving abilities, and technical skills. - Practice coding challenges related to Node.js and testing frameworks. 7. Research Companies: - Look for companies that align with your interests and values. - Research their tech stack and see if they use Node.js or have a strong focus on automation testing. Remember, persistence and continuous learning are key. Good luck with your job search --
Hello Sir, First of all I want to Thank you for creating such nice content on every topics. I have one question. I have total 10 years of exp in IT and I am working as automation tester. My skill sets are Java, selenium, POM, Cucumber, Rest Assured. I am looking to change my job. Can you please suggest.What other skills I should learn to grow in my career for that much experience. Thanks in advance.
Abhishek Most welcome. As an experienced automation tester, you're already equipped with valuable skills. To further enhance your career, consider the following: 1. Programming and Scripting Proficiency: - Strengthen your foundation in programming languages like Python, Java, or JavaScript. These skills are crucial for writing automated test scripts and creating robust testing frameworks - Dive deeper into object-oriented programming concepts, algorithms, and code structures to develop efficient, maintainable, and scalable automation solutions. 2. Understanding of Software Development and QA Processes: - Familiarize yourself with the software development lifecycle (SDLC) and quality assurance (QA) methodologies. - Learn about Agile practices, DevOps, and continuous integration/continuous deployment (CI/CD) pipelines. Integrating automation testing seamlessly into the development process is essential 3. Soft Skills: - Communication: Effective communication is vital. Collaborate with cross-functional teams, articulate test results, and provide actionable feedback. - Analytical Thinking: Sharpen your problem-solving skills. Analyze complex scenarios, identify bottlenecks, and optimize test processes. - Risk Assessment: Understand risk-based testing. Prioritize test cases based on criticality and impact. 4. Stay Updated with Industry Trends: - Technology evolves rapidly. Keep learning about new tools, frameworks, and best practices. - Explore emerging areas like AI/ML testing, mobile automation, and cloud-based testing. Remember, continuous learning and adaptability are key to long-term success in automation testing. Best of luck with your career transition --
Hi @Raghav I tried Playwright Java installation as per the documentation, However I am facing untrusted local certificate issue when the example code tries to download the browser binaries. Can you please help ?
I came to your channel when I was searching for some issue. But thanks to youtube I found your amazing channel .. I spent some hours watching and exploring it; really amazing content!!! I would like to take your advice on a situation I'm facing .. we have some vendor apps that does not allow Silent installation and we need to automate that process, apps allow only GUI interaction and applying onscreen parameters :( I saw your tutorial about Autoit, but it generates EXE that will be probably rejected by Security team specially in PRD environment. Is there other recommended tools? Many thanks in advance bro!
Hasan There are a few other tools that you can use to automate the installation of applications that do not allow silent installation. One option is to use a tool like **UiPath**. UiPath is a powerful automation tool that can be used to automate a wide variety of tasks, including the installation of applications. UiPath is a commercial tool, but it offers a free community edition that you can use for personal and non-commercial use. Another option is to use a tool like **Selenium**. Selenium is an open-source tool that can be used to automate the interaction with web applications. You can use Selenium to automate the installation of an application by interacting with the application's installer GUI. Finally, you can also use a tool like **AutoHotkey**. AutoHotkey is a scripting language that can be used to automate a wide variety of tasks. You can use AutoHotkey to automate the installation of an application by creating a script that simulates the user clicking on the installer's GUI elements. Which tool you use will depend on your specific needs and preferences. If you need a powerful automation tool that can be used to automate a wide variety of tasks, then UiPath is a good option. If you are looking for a free tool, then the UiPath community edition is a good option. If you only need to automate the installation of applications, then Selenium or AutoHotkey are good options. Here are some additional things to keep in mind: * When automating the installation of applications, it is important to make sure that the applications are installed correctly. You should test the automation script thoroughly to make sure that it does not cause any problems. * You should also make sure that the automation script is secure. You should avoid using any tools that generate EXE files that are not approved by your security team. I hope this helps!
Hi Raghav, I really appreciate all your efforts in teaching Playwright. Really help and awesome videos to learn and automate using playwright. I am able to successfully write and run end to end test cases using Playwright. I have question in relation to how to use a test data sheet and link it to a test case. For example, I have a bunch of customers details for which I want to use the test case to use and execute the same test cases for various test data in the spreadsheet. Can you please provide some details around how to create a test data and associate the same to the test case.
Hi Rahman, You can link test data to test cases in Playwright using a spreadsheet or a CSV file. You can store test data in a spreadsheet, with each row representing a set of test data, and then read that data in your test cases. Eg: const fs = require('fs'); const csv = require('csv-parser'); const results = []; fs.createReadStream('testdata.csv') .pipe(csv()) .on('data', (data) => results.push(data)) .on('end', () => { for (const data of results) { describe(`Test for ${data.username}`, () => { it('test case 1', async () => { // Use data in test case }); }); } }); This code uses the fs module to read the CSV file, the csv-parser library to parse the data, and the describe and it functions from Mocha to define test cases. You can modify this code to fit your specific requirements. The describe function allows you to group test cases, while the it function allows you to define individual test cases. In each test case, you can use the data from the data object to perform tests.
Hii Sir,I tried to add to add karate gatling reports to prometheus and grafana through datawriter concept add to gatling.conf but i cant see results if possible plz make a video on that .
Hi Karthic Both combinations are possible and can be used depending on the project requirements and the developer's expertise Using Playwright with JavaScript is suitable for developers and testers who have experience with JavaScript and prefer to work with Node.js. JavaScript is a popular programming language with a large community, so it is easy to find solutions to any issues or problems that may arise during development. On the other hand, using Playwright with Java is suitable for developers and testers who prefer to work with Java, which is also a popular programming language. Java has been in use for a long time and has a vast community, so there are numerous libraries and tools available to help developers in their development work. Ultimately, the choice between using Playwright with JavaScript or Java depends on the specific needs and skills of the dev and testing team
just a notice for taking screenshots to keep for later. It would be great if your video recording window would disappear for a second to be able to make a clean screenshot (putting your watermark somewhere instead perhaps) because your video recording screen covers partly the bullet points you are describing. Otherwise excellent tutorial, thanks a lot
Hi, Yes, Playwright can be a good option for automating web applications built on React, as it is a modern and flexible tool that supports multiple browsers and operating systems Playwright was specifically designed to handle the challenges of modern web development, such as single-page applications and web components, which are often used in React applications Other options for web application automation built on React include: Cypress: A popular open-source tool for end-to-end testing of web TestCafe: Another open-source testing tool, TestCafe can be used for automated testing of web applications built on React, as well as other frameworks. Selenium: As mentioned earlier, Selenium is a widely-used tool for web automation and can also be used to automate web applications built on React. Puppeteer: Puppeteer is a Node.js library that provides a high-level API for automating Chrome and other Chromium-based browsers. It can be used to automate web applications built on React. Ultimately, the choice of tool depends on your specific requirements, such as the type of application you are testing, the programming language you prefer, and the level of expertise you have with a particular tool. I have created a video on Playwright vs Cypress here - th-cam.com/video/cixkQHNkoZ4/w-d-xo.html
thanks for this video series, i want to use playwrite add on in my storybook ,can you make a video of any by making a component and use stories to test ,i would be helpfull 🙂
Hi Prashant Cypress, Playwright, and Puppeteer are all end-to-end testing frameworks that allow you to automate user interactions with web applications. They all have their own strengths and weaknesses, so the best choice for you will depend on your specific needs *Cypress* is a JavaScript-based framework that is known for its ease of use and its ability to provide detailed test reports. It is also very good at handling asynchronous events, which can be a challenge for other frameworks. However, Cypress can be slow to start up and it can be difficult to debug tests *Playwright* is a newer framework that is built on top of Chromium. It is very fast and it can be used to automate tests on a variety of browsers, including Chrome, Firefox, and Edge. Playwright also supports a wide range of user interactions, including clicking, typing, and dragging. However, Playwright is still under development and it can be difficult to find documentation and examples *Advantages* Here are some of the advantages of using Cypress, Playwright, and Puppeteer for end-to-end testing: *Automated testing:* These frameworks can automate user interactions with web applications, which can save time and improve the quality of testing. *Detailed test reports:* Cypress and Playwright can generate detailed test reports that can help you identify and fix bugs. *Support for asynchronous events:* Cypress is very good at handling asynchronous events, which can be a challenge for other frameworks. *Support for a variety of browsers:* Playwright supports a wide range of browsers, including Chrome, Firefox, and Edge. *Large community of users and contributors:* Puppeteer has a large community of users and contributors, which can make it easier to find documentation and examples
Ankita Let's dive into the world of test fixtures in Playwright, breaking it down for beginners. ## What Are Test Fixtures? - Test fixtures are like the backstage crew for a theater performance. They set up the stage, props, and lighting before the actors come in. Similarly, in software testing, fixtures prepare the environment for each test. - Think of fixtures as a handy toolkit that provides everything a test needs-no more, no less. They ensure that each test runs in a clean, isolated setup. ## Why Use Test Fixtures? 1. Isolation: Fixtures keep tests separate. Changes made by one test won't affect others. 2. Reusability: You can reuse fixtures across multiple tests. Imagine having a toolbox with tools you can use in different projects. 3. Efficiency: Fixtures set up only what's needed for a specific test. No unnecessary overhead. ## Common Built-in Fixtures in Playwright: 1. `page` (Isolated Page): - Represents a browser page for a single test. - Example: ```javascript test('basic test', async ({ page }) => { await page.goto('playwright.dev/'); await expect(page).toHaveTitle(/Playwright/); }); ``` 2. `context` (Isolated Browser Context): - Provides an isolated context for a test run. - The `page` fixture belongs to this context. - Useful for scenarios like logging in with different users. - Learn how to configure context. 3. `browser` (Shared Browser): - Browsers are shared across tests to optimize resources. - Learn how to configure the browser. 4. `browserName` (Browser Name): - Tells you which browser (chromium, firefox, or webkit) is running the test. 5. `request` (Isolated API Request Context): - Provides an isolated instance for making API requests during testing. ## Example: Traditional vs. Fixture-Based Setup ### Traditional (Without Fixtures): ```javascript const { test } = require('@playwright/test'); const { TodoPage } = require('./todo-page'); test.describe('todo tests', () => { let todoPage; test.beforeEach(async ({ page }) => { todoPage = new TodoPage(page); await todoPage.goto(); await todoPage.addToDo('item1'); await todoPage.addToDo('item2'); }); test.afterEach(async () => { await todoPage.removeAll(); }); test('should add an item', async () => { await todoPage.addToDo('my item'); // ... }); test('should remove an item', async () => { await todoPage.remove('item1'); // ... }); }); ``` ### With Fixtures: - Fixtures encapsulate setup and teardown in one place. - Reusable between test files. - On-demand setup. - Composable and flexible. - Simplifies grouping. ## Conclusion Test fixtures make your testing life easier. They provide a clean, organized way to set up your test environment. Now you're ready to use fixtures like a pro
Neelam By design, Playwright is primarily intended for automating web browsers, not desktop applications. Its core functionality is built around interacting with web pages, not desktop applications While Playwright itself is not designed for desktop automation, there are some creative workarounds and third-party libraries that might allow you to use Playwright for desktop automation. For example: * Accessibility APIs: Some desktop applications expose accessibility APIs that can be used to automate interactions. Playwright could potentially be used to interact with these APIs, but this would require additional development and might not be straightforward. * UI Automation frameworks: There are UI automation frameworks like Appium, Robot Framework, or PyAutoGUI that can be used to automate desktop applications. In theory, you could use Playwright to drive a UI automation framework, but this would require significant customization and might not be the most efficient approach.
Absolutely! Testing dashboards is crucial for ensuring data accuracy and functionality, and several tools, including Playwright, can be effectively used for this purpose. Here's a breakdown of various options: Playwright: - While Playwright excels at testing web applications, it can also handle dashboard testing with some considerations: - Limited visual comparison: Playwright primarily asserts on text content and element interactions, not complex visualizations. - Need for scripting: You might need to write custom logic to analyze charts and graphs effectively. Advantages: - Familiar language (TypeScript, JavaScript, Python, .NET) - Cross-browser testing - Fast and reliable Alternatives: - Cypress: Similar to Playwright, good for basic dashboard testing but limited in visual verification. - Selenium: Widely used, supports advanced visual comparisons but can be more complex to set up. - Specialized tools: - Applitools: Focuses on visual regression testing, ideal for verifying chart layouts and colors. - TestCraft: Designed specifically for BI and data visualization testing, offers pre-built assertions for charts and graphs. Choosing the right tool: - Complexity of dashboard: For simple dashboards, Playwright or Cypress might suffice. For complex visualizations, consider Applitools or TestCraft. - Development team familiarity: Select a tool with languages your team is comfortable with for easier adoption. - Specific needs: Assess your testing requirements (visual verification, performance, data accuracy) and choose a tool that addresses them effectively. Additional tips: - Combine tools for comprehensive testing: Use Playwright for basic functionality and Applitools for visual regression. - Start with manual testing to identify key areas for automation. - Pay attention to performance and usability aspects during testing. I hope this helps
Aditya Playwright is primarily designed for automating web browsers, not mobile apps. However, it does provide some mobile-related features through its browser emulation capabilities. Playwright allows you to emulate mobile devices using its `browserType.launch` method with the `--mobile` flag. This enables you to simulate mobile devices, such as iPhones or Android phones, within a desktop browser. While this is useful for testing mobile-responsive web applications, it's not the same as automating native mobile apps. To automate native mobile apps, you need a framework that can interact with the mobile operating system and the app itself. Some popular alternatives for mobile app automation are: * Appium: An open-source test automation framework that supports both Android and iOS. * Robot Framework: A generic test automation framework that can be used with various libraries, including those for mobile app automation. * Espresso (Android) and XCTest (iOS): Native testing frameworks provided by the respective mobile operating systems. -
@raghav, Thanks for your guidance on new automation tools. Could you please make a video on AI Powered Test Automation Tools and how it is different from playwright. Thanks
@raghav Hope you are doing good sir Am a manaul tester with 9 years of exp want to switch in automation Which tool should i learn playwright or salnium I have. 0 coding knowledge Hope you reply
Diwanshu As a manual tester with 9 years of experience looking to transition into automation, choosing the right tool is crucial. Let's compare Playwright and Selenium to help you make an informed decision: 1. Playwright: - What is Playwright? Playwright, developed by Microsoft, is a headless browser testing framework. It provides a high-level API for automating web browsers (Chrome, Firefox, and WebKit) and supports multiple programming languages (JavaScript, Python, Java, and .NET C#). - Strengths: - Modern Features: Playwright is designed for modern web applications and handles features like single-page applications, web components, and shadow DOM efficiently. - Fast Performance: It offers high-speed execution, making it suitable for complex scenarios. - Auto-Wait Strategy: Playwright automatically waits for elements to be actionable, reducing the need for explicit waits. - Cross-Browser Testing: It supports Chrome, Firefox, and WebKit. - Considerations: - Limited Coverage: While Playwright excels in complex web applications, its browser support is narrower compared to Selenium. - Learning Curve: As a beginner, you'll need to learn JavaScript or another supported language. - Smaller Community: The Playwright community is growing but not as extensive as Selenium's. - Recommended for: Testers working on modern web applications who prioritize performance and accuracy. 2. Selenium: - What is Selenium? Selenium is a widely adopted open-source automation framework for web testing. It supports multiple programming languages (Java, Python, C#, etc.) and has a large community. - Strengths: - Comprehensive Coverage: Selenium supports a wide range of browsers (Chrome, Firefox, Edge, Safari, etc.) and platforms. - Versatility: Its language support and community make it versatile and reliable. - Strong Community: Selenium has been around for years, and its community provides extensive resources and support. - Considerations: - Explicit Waits: Selenium requires explicit waits (implicit, explicit) to handle dynamic elements, which can lead to flaky tests. - Handling Modern Features: While Selenium can handle modern web features, it may not be as efficient as Playwright. - Learning Curve: Learning Java or another language might be necessary. - Recommended for: Testers who need comprehensive browser coverage, scalability, and flexibility. 3. Decision Factors: - Prioritize Coverage: If broad browser support is critical, consider Selenium. - Modern Applications: For modern web apps, Playwright's features shine. - Coding Knowledge: Since you're starting from scratch, both tools require learning, but Selenium might be more familiar due to its longevity.
When you load the Playwright extension from Visual Studio Code, and it says that the extension is enabled globally, this means that the Playwright extension is installed globally on your computer, and not just in your Visual Studio Code workspace. There are a few reasons why you might want to load the Playwright extension from Visual Studio Code instead of using the global installation: * To be able to use the Playwright extension in multiple Visual Studio Code workspaces. * To be able to use the latest version of the Playwright extension, even if you have an older version of the Playwright extension installed globally. * To be able to use the Playwright extension with a specific version of Node.js, even if you have a different version of Node.js installed globally. To load the Playwright extension from Visual Studio Code, follow these steps: 1. Open Visual Studio Code. 2. Click on the **Extensions** icon in the sidebar. 3. Search for "Playwright" in the extensions marketplace. 4. Click on the **Install** button next to the Playwright extension. 5. Once the extension is installed, click on the **Reload** button to reload Visual Studio Code. Once the Playwright extension is loaded from Visual Studio Code, you can start using it to test your web applications. If you are still getting the error message "This extension is enabled globally" after following these steps, then you can try the following: * Close Visual Studio Code and reopen it. * Try restarting your computer. * Uninstall the Playwright extension from Visual Studio Code and then reinstall it.
Ok, Let's break down the problem into smaller, manageable steps. Here's a step-by-step guide to help you learn automation: Step 1: Identify Your Goals * What do you want to automate? (e.g., tasks at work, personal tasks, data entry, etc.) * What benefits do you expect from automation? (e.g., save time, increase efficiency, reduce errors, etc.) Step 2: Choose an Automation Tool * Research popular automation tools that don't require extensive coding knowledge Step 3: Learn the Basics of the Chosen Tool Step 4: Understand Basic Concepts Step 5: Practice and Build Simple Automations Step 7: Apply Automation to Real-World Scenarios
Thank you again for this series, very useful and very easy to follow. Currently we use Jest to do component-testing. Is it possible to do component testing with Playwright?
Nicolae Yes, it is possible to do component testing with Playwright. Playwright has a built-in feature for component testing, which was introduced in version 1.22.0. To use Playwright for component testing, you need to create a test script that imports and tests your components. You can use the `mount()` method to mount the component to the DOM and then interact with the component using Playwright's methods. Here is an example of a Playwright component test script: ``` import { test, expect } from '@playwright/test'; import { MyComponent } from './MyComponent'; test('MyComponent should render correctly', async () => { const component = await test.mount(MyComponent); expect(component).toBeInTheDocument(); expect(component).toHaveTextContent('Hello, world!'); }); ``` To run the component test script, you can use the following command: ``` npx playwright test ``` Playwright will run the test script and generate a report. The report will show you whether the test passed or failed, as well as any errors that occurred. Playwright component testing is still under development, but it is already a powerful tool for testing React components. Playwright provides a number of features that make it a good choice for component testing, such as: *Support for multiple browsers.* Playwright supports a variety of browsers, including Chromium, Firefox, and WebKit. This allows you to test your components in multiple browsers without having to write separate tests for each browser. *Parallel execution.* Playwright can run tests in parallel, which can significantly reduce the time it takes to run your tests. *Reporting.* Playwright generates a report that shows you the results of your tests. The report includes information such as whether the test passed or failed, as well as any errors that occurred. If you are looking for a tool to test your React components, Playwright is a good option to consider. It is a powerful tool that provides a number of features that make it a good choice for component testing. I hope this helps
Hi Sir, in playwright JavaScript bdd framework ..I have written feature file and step definitions ..But when I click on feature file step it should navigate implementented step definition s..can you please help to me
Sanjeev To navigate from a step in your feature file to its corresponding step definition, follow these steps: 1. Configure VSCode Settings: - Open your project in Visual Studio Code (VSCode) - To resolve any issues with displaying undefined steps in the feature file, update the Cucumber settings in the VSCode user settings file - Specify the correct paths to the feature files and step definition files in your settings 2. Install the Cucumber Extension: - Make sure you have the "Cucumber (Gherkin) Full Support" extension installed in VSCode - You can find it in the VSCode Extensions marketplace 3. Create a `.vscode` Folder: - In your project folder, create a `.vscode` folder (at the root level, not in any subfolder) 4. Create a `settings.json` File: - Inside the `.vscode` folder, create a `settings.json` file - Add the following configuration (adjust paths as needed): ```json { "cucumberautocomplete.steps": ["steps/*js"], "cucumberautocomplete.syncfeatures": "features/*feature", "cucumberautocomplete.strictGherkinCompletion": true } ``` Replace `"steps/*js"` with the actual path to your step definition files and `"features/*feature"` with the path to your feature files 5. Reopen the Project Folder in VSCode: - Close and reopen the folder where `.vscode` is located to apply the settings Now, when you right-click on a step in your feature file, it should navigate to the corresponding step definition -
Let's break down the problem step by step: Step 1: Verify Feature File and Step Definitions * Can you confirm that you have written a feature file (e.g., `example.feature`) with scenarios and steps? * Have you implemented the corresponding step definitions in a separate file (e.g., `example.steps.js`)? Step 2: Check Feature File Syntax * Make sure the feature file syntax is correct. A typical feature file should start with the `Feature` keyword, followed by a description, and then scenarios with steps. * Verify that each step in the feature file starts with a keyword like `Given`, `When`, `Then`, `And`, or `But`. Step 3: Ensure Step Definitions are Correctly Linked * In your step definitions file (e.g., `example.steps.js`), make sure you have exported the step definitions using the `module.exports` syntax. * Verify that the step definitions are correctly linked to the feature file steps using the `Given`, `When`, `Then`, `And`, or `But` keywords Step 4: Check Playwright Configuration * Ensure that you have correctly configured Playwright to use your feature files and step definitions * Check your `playwright.config.js` file (or equivalent) to ensure that it points to the correct location of your feature files and step definitions Step 5: Verify Clicking on Feature File Step * When you click on a step in the feature file, Playwright should navigate to the corresponding step definition * If this is not happening, try checking the console output for any error messages that might indicate the issue Step 6: Check for Duplicate Step Definitions * If you have multiple step definitions files, ensure that there are no duplicate step definitions that might be causing the issue Step 7: Try Debugging * Try debugging your step definitions by adding console logs or using a debugger to see if the step definitions are being executed correctly * This can help you identify if the issue is with the step definitions themselves or with the linking between the feature file and step definitions If you've checked all of these steps and are still having issues, please provide more details about your project setup, feature file, and step definitions, and I'll do my best to help you troubleshoot the problem -
Amar Certainly, I can assist you in sending Playwright test reports to a Slack channel using TypeScript. Here's a step-by-step guide to achieve this: 1. **Install Required Packages:** Install the necessary packages for Playwright and Slack interactions using npm: ```bash npm install playwright @slack/web-api ``` 2. **Configure Slack Web API:** Create a Slack app and obtain the OAuth token for your Slack bot. Store this token securely as an environment variable named `SLACK_BOT_USER_OAUTH_TOKEN`. 3. **Create the Playwright Report Sender:** Create a TypeScript file (e.g., `playwrightSlackReporter.ts`) to handle the report generation and sending process: ```typescript import { defineConfig } from '@playwright/test'; import { SlackClient } from '@slack/web-api'; export async function sendPlaywrightReportToSlack(report: string, channels: string[]) { const slackClient = new SlackClient({ token: process.env.SLACK_BOT_USER_OAUTH_TOKEN }); for (const channel of channels) { const message = { channel: channel, text: `Playwright Test Report: ${report}`, }; await slackClient.chat.postMessage(message); } } ``` 4. **Integrate with Playwright Configuration:** In your Playwright test configuration file (e.g., `playwright.config.ts`), import the report sender function and use it to send the report after test execution: ```typescript import { defineConfig } from '@playwright/test'; import { sendPlaywrightReportToSlack } from './playwrightSlackReporter'; export default defineConfig({ reporter: [ ['html', { outputFile: 'test-results.html' }], async ({ config, report }) => { const channels = ['#playwright-tests', '#dev-reports']; await sendPlaywrightReportToSlack(report.toString(), channels); }, ], }); ``` 5. **Run Playwright Tests:** Execute your Playwright tests using the `npx playwright test` command. The generated test reports will be sent to the specified Slack channels upon test completion.
Hello , your videos are always useful. I would like to know if you have series of Playwright with .Net please similar to Node project series with Playwright? Thanks
Sanjeev To highlight text in Playwright JavaScript, you can use the following steps: 1. **Get the text locator.** You can use the `querySelector()` method to get the text locator for the text that you want to highlight. 2. **Create a new `Highlight` object.** You can use the `new Highlight()` constructor to create a new `Highlight` object. 3. **Set the text locator for the `Highlight` object.** You can use the `setLocator()` method to set the text locator for the `Highlight` object. 4. **Highlight the text.** You can use the `highlight()` method to highlight the text. The following code snippet shows how to highlight text in Playwright JavaScript: ```javascript // Get the text locator. const textLocator = await page.querySelector('.my-text'); // Create a new Highlight object. const highlight = new Highlight(); // Set the text locator for the Highlight object. highlight.setLocator(textLocator); // Highlight the text. highlight.highlight(); ``` You can also use the `highlight()` method to highlight text for a specific duration. To do this, you can pass a duration in milliseconds to the `highlight()` method. The following code snippet shows how to highlight text for a specific duration in Playwright JavaScript: ```javascript // Get the text locator. const textLocator = await page.querySelector('.my-text'); // Create a new Highlight object. const highlight = new Highlight(); // Set the text locator for the Highlight object. highlight.setLocator(textLocator); // Highlight the text for 5 seconds. highlight.highlight(5000); ``` Once you have highlighted the text, you can use the `unhighlight()` method to unhighlight the text. The following code snippet shows how to unhighlight text in Playwright JavaScript: ```javascript // Get the text locator. const textLocator = await page.querySelector('.my-text'); // Create a new Highlight object. const highlight = new Highlight(); // Set the text locator for the Highlight object. highlight.setLocator(textLocator); // Highlight the text. highlight.highlight(); // Unhighlight the text. highlight.unhighlight(); ```
Playwright is good choice for automating React applications. Here's why: 1. Targeting React Components: - With Playwright, you can easily target React components to test modular UIs - It ensures test reliability and speed, allowing developers to focus on building rather than debugging. 2. Features of Playwright: - Cross-Browser Compatibility: Playwright works with modern rendering engines (Firefox, WebKit, Chromium). - Headless and GUI Modes: Launch browsers in GUI mode for development/debugging or headless mode for faster testing. - Cross-Language Support: Access the Playwright API from JavaScript, TypeScript, Python, .NET, and Java. - Mobile Web Evaluation: Supports Chrome for Android and Mobile Safari native emulation. - CI Integration: Easily integrate with CI environments for continuous testing. - Playback and Codegen Recording: Create test scripts by recording interactions with the browser 3. Unified Testing Strategy: - Playwright helps create a unified testing strategy across different levels, including end-to-end testing for React applications Feel free to explore Playwright for your React projects-it's a powerful tool for automating web interactions Do a POC before finalising the tool -
Hi Raghav , Should i choose javascript or python to learn playwright?.which will have better opportunities in the market? I have experience in selenium java. Please give your opinion.
Sourabh Here's my opinion on choosing JavaScript or Python for Playwright, considering market opportunities and your Selenium Java experience: Overall, both JavaScript and Python offer excellent support for Playwright and have strong job market prospects. The best choice depends on your preferences, experience, and career goals: Factors to Consider: - JavaScript: - Pros: - Native language of Playwright, providing seamless integration and potential performance benefits. - Extensive ecosystem of libraries, tools, and resources for web development. - Strong demand in both web development and automation testing. - Cons: - Less familiar to you based on your Java background. - Dynamic typing might require more testing discipline. - Python: - Pros: - Widely used for automation testing, with a large community and support. - Known for readability and ease of learning. - Extensive libraries for data manipulation and analysis. - Cons: - Not the native language of Playwright, potentially introducing some overhead. Recommendations: - If you're comfortable with JavaScript or interested in expanding your web development skills, it's an excellent choice for Playwright. - If you prefer a language with clear syntax and extensive libraries for testing and data handling, Python is a strong option. - Your experience with Selenium Java gives you a foundation for understanding testing concepts, making the transition to either language manageable. Market Opportunities: - Both JavaScript and Python have significant demand for automation testing roles. - Consider the specific industries and companies you're interested in to assess their tech stacks and preferred languages. Additional Tips: - Try both languages through tutorials or small projects to get a feel for their syntax and style. - Evaluate your comfort level with dynamic vs. static typing. - Consider your long-term career goals and potential for growth in each language. - Explore the Playwright documentation and community resources in both languages to assess their support and ease of use. Ultimately, the best choice is the one that aligns with your skills, interests, and career aspirations. Both JavaScript and Python are powerful tools for Playwright, and you can achieve great results with either language.
Hi Raghav, Thanks for this series. Please answer my doubt: I have an application built using angular and typescript. Can we use playwright to automate angular application with Java OR is it mandatory to use Javascript in playwright?
Hi @Raghav, when I ran this command npx playwright test .\tests\AnnotationsAndTags.spec.js --project=chrome --grep "@smoke", I got the attached error " Running 0 tests using 0 workers Error: Requiring @playwright/test second time, First: Error: at Object. (C:\Users\oluse\OneDrive\Desktop\Playwright ode_modules\@playwright\test\lib\index.js:64:33) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Object.t..tu._extensions. [as .js] (C:\Users\oluse\OneDrive\Desktop\Playwright ode_modules\@playwright\test\lib\utilsBundleImpl.js:16:1010) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (C:\Users\oluse\OneDrive\Desktop\Playwright ode_modules\@playwright\test\index.js:17:13) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Object.t..tu._extensions. [as .js] (C:\Users\oluse\OneDrive\Desktop\Playwright ode_modules\@playwright\test\lib\utilsBundleImpl.js:16:1010) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) Second: at Object. (C:\Users\oluse\OneDrive\Desktop\Playwright\tests ode_modules\@playwright\test\lib\index.js:59:11) at Object. (C:\Users\oluse\OneDrive\Desktop\Playwright\tests ode_modules\@playwright\test\index.js:17:13) at Object. (C:\Users\oluse\OneDrive\Desktop\Playwright\tests\AnnotationsAndTags.spec.js:3:13)". Kindly assist
Hi Anupam, it will depend on your needs, requirements and features you need. To help you make the decision Selenium vs Cypress - th-cam.com/video/2anO9t6-oT8/w-d-xo.html Cypress vs Playwright - th-cam.com/video/cixkQHNkoZ4/w-d-xo.html
Hi raghav , javascript is mandatory to learning playwright tool. Current I am using selenium- Java. Java is better ya learn separate javascript language? & Then after learn playwright. This is a way ?
Shiv While JavaScript is the primary language for Playwright, it's not strictly mandatory to learn it extensively before diving in, especially if you have a Java background. Here are your options: *1. Utilize Playwright Java:* - Playwright offers a Java API, allowing you to write tests in Java while leveraging Playwright's features. - This approach aligns with your existing Java experience. - Example: ```java import com.microsoft.playwright.*; public class ExampleTest { public static void main(String[] args) { try (Playwright playwright = Playwright.create()) { Browser browser = playwright.chromium().launch(); Page page = browser.newPage(); page.navigate("playwright.dev"); // ... your test actions } } } ``` *2. Consider Playwright for Java's JUnit 5 Extension:* - This extension streamlines Playwright test integration into JUnit 5 test suites. - It provides annotations for test setup and execution. *3. Explore Playwright for Java's Gradle Plugin:* - If you use Gradle, this plugin simplifies Playwright dependency management and test execution. *4. Learn Basic JavaScript (Recommended):* - Even with Playwright Java, a basic understanding of JavaScript syntax and concepts is beneficial: - Interact with browser APIs more effectively. - Understand Playwright's underlying mechanisms better. - Troubleshoot issues more efficiently. - Potentially contribute to Playwright's open-source development. *Key Considerations:* - *Learning Curve:* Playwright's Java API is relatively new and less mature compared to its JavaScript counterpart. Expect some learning curve and potential limitations. - *Long-Term Benefits:* Investing in JavaScript knowledge can expand your testing capabilities and open doors to other tools and frameworks in the web development ecosystem. *Recommendations:* - *Start with Playwright Java:* Leverage your Java experience to quickly adopt Playwright's core features. - *Gradually Learn JavaScript:* Incrementally introduce JavaScript concepts as needed for deeper understanding and flexibility. - *Explore JavaScript Resources:* Utilize online tutorials, courses, and documentation to learn JavaScript basics.
Yes, Playwright is compatible with desktop applications. While Playwright is primarily known for its web automation capabilities, it also supports automating desktop applications across different platforms. Playwright provides a unified API that allows you to automate web browsers (Chrome, Firefox, WebKit) as well as desktop applications using the same programming language and codebase. It supports automating desktop applications on Windows, macOS, and Linux. To automate desktop applications using Playwright, you would typically use the appropriate API methods and functions provided by Playwright for interacting with the user interface elements, performing actions, and retrieving information from the application. Here's a high-level example of automating a desktop application with Playwright: ```javascript const { chromium } = require('playwright'); (async () => { const app = await chromium.launch(); const context = await app.newContext(); const page = await context.newPage(); // Navigate to the desktop application await page.goto('your-desktop-app-url'); // Perform actions on the application, e.g., clicking buttons, filling forms, etc. await page.click('#button-id'); await page.fill('#input-field-id', 'Hello, World!'); // Retrieve information from the application, e.g., reading text, getting values, etc. const labelText = await page.innerText('#label-id'); console.log('Label Text:', labelText); await app.close(); })(); ``` This is just a basic example, and the specific methods and APIs you use will depend on the desktop application and its UI framework. Playwright supports popular UI frameworks like Win32, WPF, UWP on Windows, and Cocoa on macOS. By leveraging Playwright's cross-browser and cross-platform capabilities, you can write automation scripts that cover both web and desktop applications, providing a unified testing experience
Hi Nathan Playwright is a tool that automates browsers, so it can be used for web applications developed with any language as long as it is accessible through a browser. In the case of ColdFusion, if the application can be accessed through a web browser, then Playwright can be used to automate testing or other tasks. Playwright provides support for popular browsers such as Chrome, Firefox, and Safari, and can also be used with headless browsers. However, if you're looking to automate tasks within ColdFusion itself, then Playwright may not be the most suitable tool. In that case, you may want to explore other automation tools that are designed specifically for ColdFusion, such as CFML-based automation frameworks or tools.
Hi Raghav sir, can you please let me know what are the pre-requisites that I need to learn before starting learning Playwright? I'm preferred to choose C# programming language but want to know what more I need to learn please in order to perform a smooth E2E testing.
Ashish To get started with Playwright and perform smooth End-to-End (E2E) testing using C#, here are the pre-requisites you should consider: 1. Programming fundamentals: * You should have a good grasp of programming concepts, such as variables, data types, control structures, functions, and object-oriented programming (OOP) principles. 2. C# programming language: * You've mentioned you prefer C#, so you should have a solid understanding of C# syntax, features, and best practices. * Familiarize yourself with C# versions 8.0 or higher, as Playwright supports these versions. 3..NET Core: * Playwright is built on top of.NET Core, so it's essential to understand the basics of.NET Core, including: +.NET Core framework + NuGet packages + Dependency injection + Configuration and settings 4. Web development basics: * Understand how web applications work, including: + HTML (structure and syntax) + CSS (styling and layout) + JavaScript (client-side scripting) + HTTP requests and responses + Web browsers and their rendering engines 5. Selenium WebDriver: * Although Playwright is an alternative to Selenium, understanding Selenium's concepts and architecture will help you appreciate Playwright's design and features. * Familiarize yourself with Selenium's WebDriver API and how it interacts with browsers. 6. Browser automation: * Learn about browser automation concepts, such as: + Browser instances and sessions + Element interaction (e.g., clicking, filling forms) + Waits and timeouts + Handling alerts and pop-ups 7. Testing frameworks and principles: * Understand testing concepts, such as: + Test-driven development (TDD) + Behavior-driven development (BDD) + Unit testing, integration testing, and E2E testing * Familiarize yourself with popular testing frameworks, such as NUnit, xUnit, or MSTest. 8. Playwright-specific knowledge: * Once you have a solid foundation in the above areas, dive into Playwright's documentation and learn about: + Playwright's architecture and design principles + Browser types and launch modes + Frames, contexts, and pages + Element handling and interaction + Waits, timeouts, and retries + Error handling and debugging -
@@RaghavPal Thank you so much for explaining me in such a detailed manner, now I can confidently start my Playwright journey with C# programming language. Thanks a ton once again for sharing this information with me sir. I'm really sorry to trouble you again with my one more query please, is this the same with the "Python" programming language too or is there is any difference when using Python with Playwright please?
Ashish Playwright provides a unified API across multiple programming languages, including C#, Python, Java, and Node.js. This means that the core concepts, such as: * Launching browsers * Creating browser contexts * Navigating pages * Interacting with elements * Handling events are similar across all supported languages. Identify the differences While the core concepts are similar, there are some differences in using Playwright with Python compared to C#: * Syntax: The most obvious difference is the syntax of the programming languages themselves. Python's syntax is more concise and flexible, while C#'s syntax is more verbose and strict. * Library usage: In C#, you would use the `Microsoft.Playwright` NuGet package, whereas in Python, you would use the `playwright` library installed via pip. * Async/await: Python's async/await syntax is more concise and expressive than C#'s, which can make the code look slightly different. * Error handling: Python's error handling mechanisms, such as try-except blocks, differ from C#'s try-catch blocks. In summary, while there are some differences in using Playwright with Python compared to C#, the core concepts and API remain the same. If you learn Playwright with C#, you can easily adapt to using it with Python, and vice versa. The main differences lie in the syntax, library usage, async/await, and error handling mechanisms of the respective programming languages. I hope this step-by-step breakdown helps clarify the differences and similarities between using Playwright with C# and Python -
@@RaghavPal Thank you so much for explaining me in such a detailed manner, now I can confidently start my Playwright journey with any programming language my company offers to choose. Thanks a ton once again for sharing this information with me sir.
In Playwright for Python, you can find multiple elements using the `locator.all()` method. This allows you to locate and interact with multiple elements that match a specific selector. Let's explore how to use it: 1. Creating a Locator: - First, create a locator using the `page.locator()` method. You can specify a CSS selector, text, or other attributes to identify the elements you want to find. - For example: ```python # Create a locator for all buttons with a specific class button_locator = page.locator('.my-button-class') ``` 2. Finding Multiple Elements: - Once you have the locator, use the `all()` method to get an array of locators pointing to all matching elements. - For example: ```python # Get all buttons with the specified class all_buttons = await button_locator.all() # Iterate over the buttons and perform actions for button in all_buttons: await button.click() ``` 3. Accessing Element Properties: - You can access properties of each element using methods like `innerText()`, `textContent()`, or other relevant methods. - For example: ```python for button in all_buttons: button_text = await button.innerText() print(f"Button text: {button_text}") ``` Remember to replace `.my-button-class` with your actual CSS selector or other attributes relevant to your use case. The `all()` method returns an array of locators, allowing you to interact with multiple elements efficiently. ..
Hi Alim, Playwright has very good features and is useful in Automation, Selenium is here since a long time and has a huge community, So it may not be right to compare these 2 I will suggest that you learn the skills and then decide what works best for you
Hi' I already writing automaticn tests using IDE = VSCode and robot framework. my question is, can I use the same vscode for trying out playwright opening a new folder or a new workspace in vscode? thanks
Péter Let's break down the problem step by step: Step 1: Understand the current setup You are currently using VSCode (Visual Studio Code) as your Integrated Development Environment (IDE) to write automatic tests using the Robot Framework. Step 2: Identify the new requirement You want to try out Playwright, a browser automation framework, and you're wondering if you can use the same VSCode instance to do so. Step 3: Consider the options To use Playwright, you have two options: a. Create a new folder within the existing workspace: You can create a new folder within your existing VSCode workspace and start writing Playwright tests there. This approach allows you to keep your Robot Framework tests and Playwright tests separate, but still within the same workspace. b. Create a new workspace in VSCode: You can create a brand new workspace in VSCode, specifically for your Playwright tests. This approach allows you to keep your Robot Framework tests and Playwright tests completely separate, with their own distinct workspaces. Step 4: Evaluate the feasibility Both options are feasible, and VSCode supports multiple folders and workspaces. You can easily create a new folder or workspace in VSCode and start writing Playwright tests. Step 5: Choose the approach The choice between options a and b depends on your personal preference and how you want to organize your projects. If you want to keep your Robot Framework and Playwright tests separate but still accessible from the same VSCode instance, option a might be suitable. If you prefer to keep them completely separate, option b might be a better fit. Conclusion Yes, you can use the same VSCode instance to try out Playwright by creating a new folder or workspace. You can choose the approach that best suits your needs and start writing Playwright tests alongside your Robot Framework tests -
I've been a manual qa tester for a fintech company for a year or so, I want to transition to automation and watching your videos will be a great start, thank you so much. I will binge watch your videos lol.
Great to hear that, All the best, If you face any issues, pls ask in the comment section
You have heard my heart ,we started using this for our application recently and first thing I did is searching ur videos.Good that you started thank you so much
Glad I could help Satya
Your playwright series has been very helpful. Thank you.
Most welcome Soumita
First search for playwright and I found you I am a manual tester and my company is switching to automation and this is what they are planning to use . I hope this will help me achieve my goals.
Thank you
Welcome aboard.. yes this should help you and let me know if you face any issues
@@RaghavPal thank you 🙏🏽
Raghav is indeed a great teacher. He goes from zero to hero! Thank you, you have helped the lives of so many people. God Bless every step! you take
So nice of you
Really excited for this series, Thanks @Raghav for getting it starts. Much Awaited 😊👍
Hope you enjoy it Sarang
Thank you very much for considering my comment and uploading playwright series🙏❤️
Most welcome
Fan ho gaya mai 🙏.... You covered so many topics and varaiety of tools with indepth skills. After following detailed steps we are able to do practically........ Jai ho Mordern time GURU 🙏
Thanks for the kind words Shwetank. Humbled
Much awaited one. Thank You @Raghav for starting this series!!
Most welcome Ramu
I am from Viet Nam and just started learning Playwright. Your all videos are beneficial for me. Thank you so much. Keep going, bro.
Most welcome Trần
Thankyou so much sir. Your videos gave me confidence to learn automation. I was scared to begin because of fear of coding but i started learning because of your videos. 🙂
Hemangi
so happy to know this
Thank you Raghav, I have started and became professional in sdet career with your guidance.. Many thanks to you for helping the community
Most welcome Sreekala. All the best for your career. Do share your knowledge and help others
Raghav Pal s the most talented and soft spoke person i have seen i this world. One day i will take selfie with real hero like you ❤❤❤
Thanks for the kind words Tamil... humbled
Thank you once again for your excelent teaching methods. I beleive I'll learn playwright very well in a couple of days by the help of your videos👍
Most welcome Akif
I have started from today
9/10
My first attempt
Thank you @raghav
Great score .. keep learning
Yrr. This Hello this is raghav is like every where. Whenever I try to learn any new framework. I'm scared if I would get want familiar trainer but now I shouldn't after seeing you on playwright. Good to see you working so hard
Thanks for watching Ayesha
Hi Raghav I was a manual functional tester with 7 years experience and 6 years of career break. Now i have got an opportunity to work on a project as a part of recruitment process. It includes automation testing in playwright. I am just starting to learn automation and hoping to complete the project. If you can provide any one-to-one guidance as i learn that will help me a lot. Please respond. This job will be a great leap in restarting my career.
Hi
You can check all sessions here
automationstepbystep.com/
Apart from this there is no live or 1-to-1 sessions. You can always ask your ques in comments
All the best
Sure. Thank you.
Just found your channel. Excellent Content - Another Sub For You Sir!
Thanks a lot
I just fount your channel , and already loving it ! Thank you Raghav
Most welcome Aisuluu
Hello, Raghav we need security testing or penetration testing series.
I will plan on that Vignesh
Thanks for the useful tutorial, and simple to understand. Quiz result 10/10
Glad it helped Kelly
Thank you Raghav 😊 Got when much needed 🙏
Most welcome
Dear Sir, This is excellent, and your way of explaining is awesome. Do you have a playlist for 'Playwright with C#'? I look forward to your reply!
Thanks Salim, not as of now, I will plan on it, can check all playlists here - automationstepbystep.com/
Clear and to the point. Thank you Raghav!
Most welcome Santie
super video. Thank u sir. I want to learn this tool. I started from today.
Most welcome
Well explained and making easy to understand fir beginners in automation
Thanks a lot Sandhya
That's a great tutorial introduction for Playwright ! many thanks Raghav
Most welcome
Hi Sir, this is amazing - one request, when you say you can take screenshot to remember the stuff, can you please hide yourself from the screen for a sec so we can take the screenshot with ease😅and you are awesome tutor, thank you!
Noted Usman, I will take care in future videos
Thanks Raghav. Scored 8/10
Great
Thank you Raghav sir for this Playwrite tutorials 🤝👍💐
Most welcome Suraj
Really great tutorial for Playwright . Many many thanks Raghav ji.
Always welcome
Thanks for you for your effort on playwright playlist. We are waiting for more videos till framwork and most of the features
Will upload soon
Got 9/10 for the quizz
Great score Enoa.. keep learning
Hello, First I would like to thank you for your work because you help people to be more efficient in their work, which is highly commendable. THANK YOU.
Second I would like to ask... Does Playwright can fill a web formulary getting data from a csv file or Excel file? I am more interested getting data from Excel or Calc (LibreOffice) files to fill web formularies.
Are you going to make a video about this interesting point?
This is a good subject for those who want to save time doing a tedious work. Please think about it. I suggest to do it or talk about that point. You will help many people to be more efficient. Many thanks
Hi Joey,
Yes, Playwright can fill a web formulary by getting data from a CSV file, Excel file, or other data sources. You can use the Playwright API to read data from CSV or Excel files and then populate the web form fields with the data.
Here's an example of how you can read data from an Excel file using the xlsx package and then use it to fill in a web form using Playwright:
const xlsx = require('xlsx');
const { chromium } = require('playwright');
(async () => {
// Load data from Excel file
const workbook = xlsx.readFile('data.xlsx');
const worksheet = workbook.Sheets['Sheet1'];
const data = xlsx.utils.sheet_to_json(worksheet);
// Launch a browser
const browser = await chromium.launch();
const context = await browser.newContext();
// Navigate to a web page with a form
const page = await context.newPage();
await page.goto('www.example.com/form');
// Fill in the form with data from the Excel file
for (let i = 0; i < data.length; i++) {
const row = data[i];
await page.fill('#input1', row['Field1']);
await page.fill('#input2', row['Field2']);
await page.fill('#input3', row['Field3']);
await page.click('#submit-button');
await page.waitForNavigation();
}
// Close the browser
await browser.close();
})();
In this example, the xlsx package is used to read data from an Excel file named data.xlsx. The worksheet variable contains the data from the Sheet1 worksheet in the Excel file. The sheet_to_json method is used to convert the worksheet data into a JSON object.
The Playwright API is then used to launch a Chromium browser, navigate to a web page with a form, and fill in the form fields with data from the Excel file. The fill method is used to populate the form fields, and the click method is used to submit the form. The waitForNavigation method is used to wait for the page to reload after the form is submitted.
Finally, the browser is closed using the close method.
You can modify this code to read data from a CSV file or other data sources as needed.
i think playwright is know well for QA Engineer Struggle while testing. Playwright build in next level in framework👍
Yes, it is good
Thanks🥺....much needed one ,, when we expect the next video
Thanks all the videos are already published can check here AutomationStepByStep.com
I got 9/10 in quiz. very clear n good explanation thank you @Raghav
Well done Sneha
I like the way you teach. thank you for doing it step by step. Making it easy for us to follow and understand.
You're very welcome Rosy
Thank uuuuuuuuu❤🎉
U are awesome 💐
Good luck, it’s very helpful and interesting sessions ❤
Most welcome Aysana
Awaited for this one, Thanks!
most welcome Hasib
Wow! Thank you so much sir! Helpful Is an understatement. God bless you.
You are most welcome
Thanks for starting this series.
Most welcome Nilesh
@@RaghavPal Please start playwright with Java framework. It could be help us.
I will do Nilesh
Hi Rgahav sir, can you please do a more descriptive video which briefly explains point by point on How to Become a Automation Tester roadmap please? It will help a lot for manual testers like me, freshers and Non-IT background people too.
Sure Ashish
@@RaghavPal Thank you so much Sir
I'm looking for job , I've experience in automation testing and node.js backend development
Punit
That's great! Having experience in both automation testing and Node.js backend development makes you a valuable candidate. Let's explore some steps to enhance your job search:
1. Update Your Resume:
- Ensure your resume highlights your relevant skills, experience, and achievements.
- Mention your proficiency in automation testing tools (such as Selenium, Cypress, or JUnit) and your experience with Node.js.
2. Job Portals and Networking:
- Post your resume on job portals like LinkedIn, Indeed, Glassdoor, and Naukri.
- Connect with professionals in your field on LinkedIn and attend networking events.
3. Customize Applications:
- Tailor your applications to each job description. Highlight specific skills that match the job requirements.
- Emphasize your experience in automation testing and Node.js development.
4. GitHub and Personal Projects:
- Showcase your skills by contributing to open-source projects on GitHub.
- Create personal projects related to automation testing or Node.js and share them on your portfolio.
5. Certifications:
- Consider obtaining relevant certifications. For automation testing, certifications like ISTQB or Selenium WebDriver can add value.
- Node.js certifications (such as Node.js Certified Developer) can also boost your profile.
6. Prepare for Interviews:
- Be ready to discuss your experience, problem-solving abilities, and technical skills.
- Practice coding challenges related to Node.js and testing frameworks.
7. Research Companies:
- Look for companies that align with your interests and values.
- Research their tech stack and see if they use Node.js or have a strong focus on automation testing.
Remember, persistence and continuous learning are key. Good luck with your job search
--
Hello Sir, First of all I want to Thank you for creating such nice content on every topics. I have one question. I have total 10 years of exp in IT and I am working as automation tester. My skill sets are Java, selenium, POM, Cucumber, Rest Assured. I am looking to change my job. Can you please suggest.What other skills I should learn to grow in my career for that much experience.
Thanks in advance.
Abhishek
Most welcome.
As an experienced automation tester, you're already equipped with valuable skills. To further enhance your career, consider the following:
1. Programming and Scripting Proficiency:
- Strengthen your foundation in programming languages like Python, Java, or JavaScript. These skills are crucial for writing automated test scripts and creating robust testing frameworks
- Dive deeper into object-oriented programming concepts, algorithms, and code structures to develop efficient, maintainable, and scalable automation solutions.
2. Understanding of Software Development and QA Processes:
- Familiarize yourself with the software development lifecycle (SDLC) and quality assurance (QA) methodologies.
- Learn about Agile practices, DevOps, and continuous integration/continuous deployment (CI/CD) pipelines. Integrating automation testing seamlessly into the development process is essential
3. Soft Skills:
- Communication: Effective communication is vital. Collaborate with cross-functional teams, articulate test results, and provide actionable feedback.
- Analytical Thinking: Sharpen your problem-solving skills. Analyze complex scenarios, identify bottlenecks, and optimize test processes.
- Risk Assessment: Understand risk-based testing. Prioritize test cases based on criticality and impact.
4. Stay Updated with Industry Trends:
- Technology evolves rapidly. Keep learning about new tools, frameworks, and best practices.
- Explore emerging areas like AI/ML testing, mobile automation, and cloud-based testing.
Remember, continuous learning and adaptability are key to long-term success in automation testing. Best of luck with your career transition
--
@@RaghavPal Thank you so much your guidence.
my score 8/10. thank
well done...
Thanks for this free tutorial :) appreciate a lot
You're very welcome Jarver
Hi @Raghav I tried Playwright Java installation as per the documentation, However I am facing untrusted local certificate issue when the example code tries to download the browser binaries. Can you please help ?
Hi Sankara, I will upload the installation steps video tomorrow, can check again with that
I came to your channel when I was searching for some issue. But thanks to youtube I found your amazing channel .. I spent some hours watching and exploring it; really amazing content!!!
I would like to take your advice on a situation I'm facing .. we have some vendor apps that does not allow Silent installation and we need to automate that process, apps allow only GUI interaction and applying onscreen parameters :(
I saw your tutorial about Autoit, but it generates EXE that will be probably rejected by Security team specially in PRD environment. Is there other recommended tools?
Many thanks in advance bro!
Hasan
There are a few other tools that you can use to automate the installation of applications that do not allow silent installation.
One option is to use a tool like **UiPath**. UiPath is a powerful automation tool that can be used to automate a wide variety of tasks, including the installation of applications. UiPath is a commercial tool, but it offers a free community edition that you can use for personal and non-commercial use.
Another option is to use a tool like **Selenium**. Selenium is an open-source tool that can be used to automate the interaction with web applications. You can use Selenium to automate the installation of an application by interacting with the application's installer GUI.
Finally, you can also use a tool like **AutoHotkey**. AutoHotkey is a scripting language that can be used to automate a wide variety of tasks. You can use AutoHotkey to automate the installation of an application by creating a script that simulates the user clicking on the installer's GUI elements.
Which tool you use will depend on your specific needs and preferences. If you need a powerful automation tool that can be used to automate a wide variety of tasks, then UiPath is a good option. If you are looking for a free tool, then the UiPath community edition is a good option. If you only need to automate the installation of applications, then Selenium or AutoHotkey are good options.
Here are some additional things to keep in mind:
* When automating the installation of applications, it is important to make sure that the applications are installed correctly. You should test the automation script thoroughly to make sure that it does not cause any problems.
* You should also make sure that the automation script is secure. You should avoid using any tools that generate EXE files that are not approved by your security team.
I hope this helps!
@@RaghavPal Thanks alot for your reply; actually they are desktop apps so I excluded Selenium .. I will check UiPath.
Thanks Pal :)
Hi Raghav, I really appreciate all your efforts in teaching Playwright. Really help and awesome videos to learn and automate using playwright. I am able to successfully write and run end to end test cases using Playwright. I have question in relation to how to use a test data sheet and link it to a test case. For example, I have a bunch of customers details for which I want to use the test case to use and execute the same test cases for various test data in the spreadsheet. Can you please provide some details around how to create a test data and associate the same to the test case.
Hi Rahman,
You can link test data to test cases in Playwright using a spreadsheet or a CSV file. You can store test data in a spreadsheet, with each row representing a set of test data, and then read that data in your test cases.
Eg:
const fs = require('fs');
const csv = require('csv-parser');
const results = [];
fs.createReadStream('testdata.csv')
.pipe(csv())
.on('data', (data) => results.push(data))
.on('end', () => {
for (const data of results) {
describe(`Test for ${data.username}`, () => {
it('test case 1', async () => {
// Use data in test case
});
});
}
});
This code uses the fs module to read the CSV file, the csv-parser library to parse the data, and the describe and it functions from Mocha to define test cases.
You can modify this code to fit your specific requirements. The describe function allows you to group test cases, while the it function allows you to define individual test cases. In each test case, you can use the data from the data object to perform tests.
I heard the voice, I hit the like
Thanks a lot Tuan
Hi i got 8/10 yeeeeeeh im so happy thank you so much for this videos
Great score
Thank you sir
Most welcome
Great session
Thanks Deepak
Hii Sir,I tried to add to add karate gatling reports to prometheus and grafana through datawriter concept add to gatling.conf but i cant see results if possible plz make a video on that .
Will plan on it Dinesh
Hi ragav,which combination is suggested?
Playwright with javascript or
Playwright with Java
Kindly choose anyone and why
Hi Karthic
Both combinations are possible and can be used depending on the project requirements and the developer's expertise
Using Playwright with JavaScript is suitable for developers and testers who have experience with JavaScript and prefer to work with Node.js. JavaScript is a popular programming language with a large community, so it is easy to find solutions to any issues or problems that may arise during development.
On the other hand, using Playwright with Java is suitable for developers and testers who prefer to work with Java, which is also a popular programming language. Java has been in use for a long time and has a vast community, so there are numerous libraries and tools available to help developers in their development work.
Ultimately, the choice between using Playwright with JavaScript or Java depends on the specific needs and skills of the dev and testing team
Can you please design a framework using csharp
I will plan
Sir, can u please provide a tutorial on React Component Testing in Playwright
I will check and try Sujith
just a notice for taking screenshots to keep for later. It would be great if your video recording window would disappear for a second to be able to make a clean screenshot (putting your watermark somewhere instead perhaps) because your video recording screen covers partly the bullet points you are describing. Otherwise excellent tutorial, thanks a lot
Thanks for the feedback. I will take care in future
Thanks, Raghav 🤩
Most welcome Aylin
Thank you Bro very good explanation!
Glad it was helpful!
Thanks Ragav for this video :). A generic query, Is playwright right tool for the web application automation built on REACT software? Please answer
Hi,
Yes, Playwright can be a good option for automating web applications built on React, as it is a modern and flexible tool that supports multiple browsers and operating systems
Playwright was specifically designed to handle the challenges of modern web development, such as single-page applications and web components, which are often used in React applications
Other options for web application automation built on React include:
Cypress: A popular open-source tool for end-to-end testing of web
TestCafe: Another open-source testing tool, TestCafe can be used for automated testing of web applications built on React, as well as other frameworks.
Selenium: As mentioned earlier, Selenium is a widely-used tool for web automation and can also be used to automate web applications built on React.
Puppeteer: Puppeteer is a Node.js library that provides a high-level API for automating Chrome and other Chromium-based browsers. It can be used to automate web applications built on React.
Ultimately, the choice of tool depends on your specific requirements, such as the type of application you are testing, the programming language you prefer, and the level of expertise you have with a particular tool.
I have created a video on Playwright vs Cypress here - th-cam.com/video/cixkQHNkoZ4/w-d-xo.html
thanks for this video series, i want to use playwrite add on in my storybook ,can you make a video of any by making a component and use stories to test ,i would be helpfull 🙂
I will check and plan Rahul
#askRaghav what is diffreance between Cypress and Playwright and Advantage
Hi Prashant
Cypress, Playwright, and Puppeteer are all end-to-end testing frameworks that allow you to automate user interactions with web applications. They all have their own strengths and weaknesses, so the best choice for you will depend on your specific needs
*Cypress* is a JavaScript-based framework that is known for its ease of use and its ability to provide detailed test reports. It is also very good at handling asynchronous events, which can be a challenge for other frameworks. However, Cypress can be slow to start up and it can be difficult to debug tests
*Playwright* is a newer framework that is built on top of Chromium. It is very fast and it can be used to automate tests on a variety of browsers, including Chrome, Firefox, and Edge. Playwright also supports a wide range of user interactions, including clicking, typing, and dragging. However, Playwright is still under development and it can be difficult to find documentation and examples
*Advantages*
Here are some of the advantages of using Cypress, Playwright, and Puppeteer for end-to-end testing:
*Automated testing:* These frameworks can automate user interactions with web applications, which can save time and improve the quality of testing.
*Detailed test reports:* Cypress and Playwright can generate detailed test reports that can help you identify and fix bugs.
*Support for asynchronous events:* Cypress is very good at handling asynchronous events, which can be a challenge for other frameworks.
*Support for a variety of browsers:* Playwright supports a wide range of browsers, including Chrome, Firefox, and Edge.
*Large community of users and contributors:* Puppeteer has a large community of users and contributors, which can make it easier to find documentation and examples
#AskRaghav Please if you can explain about what are test fixtures? and its usage in detail.Thanks
Ankita
Let's dive into the world of test fixtures in Playwright, breaking it down for beginners.
## What Are Test Fixtures?
- Test fixtures are like the backstage crew for a theater performance. They set up the stage, props, and lighting before the actors come in. Similarly, in software testing, fixtures prepare the environment for each test.
- Think of fixtures as a handy toolkit that provides everything a test needs-no more, no less. They ensure that each test runs in a clean, isolated setup.
## Why Use Test Fixtures?
1. Isolation: Fixtures keep tests separate. Changes made by one test won't affect others.
2. Reusability: You can reuse fixtures across multiple tests. Imagine having a toolbox with tools you can use in different projects.
3. Efficiency: Fixtures set up only what's needed for a specific test. No unnecessary overhead.
## Common Built-in Fixtures in Playwright:
1. `page` (Isolated Page):
- Represents a browser page for a single test.
- Example:
```javascript
test('basic test', async ({ page }) => {
await page.goto('playwright.dev/');
await expect(page).toHaveTitle(/Playwright/);
});
```
2. `context` (Isolated Browser Context):
- Provides an isolated context for a test run.
- The `page` fixture belongs to this context.
- Useful for scenarios like logging in with different users.
- Learn how to configure context.
3. `browser` (Shared Browser):
- Browsers are shared across tests to optimize resources.
- Learn how to configure the browser.
4. `browserName` (Browser Name):
- Tells you which browser (chromium, firefox, or webkit) is running the test.
5. `request` (Isolated API Request Context):
- Provides an isolated instance for making API requests during testing.
## Example: Traditional vs. Fixture-Based Setup
### Traditional (Without Fixtures):
```javascript
const { test } = require('@playwright/test');
const { TodoPage } = require('./todo-page');
test.describe('todo tests', () => {
let todoPage;
test.beforeEach(async ({ page }) => {
todoPage = new TodoPage(page);
await todoPage.goto();
await todoPage.addToDo('item1');
await todoPage.addToDo('item2');
});
test.afterEach(async () => {
await todoPage.removeAll();
});
test('should add an item', async () => {
await todoPage.addToDo('my item');
// ...
});
test('should remove an item', async () => {
await todoPage.remove('item1');
// ...
});
});
```
### With Fixtures:
- Fixtures encapsulate setup and teardown in one place.
- Reusable between test files.
- On-demand setup.
- Composable and flexible.
- Simplifies grouping.
## Conclusion
Test fixtures make your testing life easier. They provide a clean, organized way to set up your test environment.
Now you're ready to use fixtures like a pro
Requesting you to give video on how to connect gmail with imap lib in js for reading mail otp . Please
I will check and plan Nagendran
Can we use playwright to automate desktop applications?
Neelam
By design, Playwright is primarily intended for automating web browsers, not desktop applications. Its core functionality is built around interacting with web pages, not desktop applications
While Playwright itself is not designed for desktop automation, there are some creative workarounds and third-party libraries that might allow you to use Playwright for desktop automation. For example:
* Accessibility APIs: Some desktop applications expose accessibility APIs that can be used to automate interactions. Playwright could potentially be used to interact with these APIs, but this would require additional development and might not be straightforward.
* UI Automation frameworks: There are UI automation frameworks like Appium, Robot Framework, or PyAutoGUI that can be used to automate desktop applications. In theory, you could use Playwright to drive a UI automation framework, but this would require significant customization and might not be the most efficient approach.
#AskRaghav Can we use Playwright to test the Analytics Dashboard? Or any other tools to test Dashboards. Pleas suggest.
Absolutely! Testing dashboards is crucial for ensuring data accuracy and functionality, and several tools, including Playwright, can be effectively used for this purpose. Here's a breakdown of various options:
Playwright:
- While Playwright excels at testing web applications, it can also handle dashboard testing with some considerations:
- Limited visual comparison: Playwright primarily asserts on text content and element interactions, not complex visualizations.
- Need for scripting: You might need to write custom logic to analyze charts and graphs effectively.
Advantages:
- Familiar language (TypeScript, JavaScript, Python, .NET)
- Cross-browser testing
- Fast and reliable
Alternatives:
- Cypress: Similar to Playwright, good for basic dashboard testing but limited in visual verification.
- Selenium: Widely used, supports advanced visual comparisons but can be more complex to set up.
- Specialized tools:
- Applitools: Focuses on visual regression testing, ideal for verifying chart layouts and colors.
- TestCraft: Designed specifically for BI and data visualization testing, offers pre-built assertions for charts and graphs.
Choosing the right tool:
- Complexity of dashboard: For simple dashboards, Playwright or Cypress might suffice. For complex visualizations, consider Applitools or TestCraft.
- Development team familiarity: Select a tool with languages your team is comfortable with for easier adoption.
- Specific needs: Assess your testing requirements (visual verification, performance, data accuracy) and choose a tool that addresses them effectively.
Additional tips:
- Combine tools for comprehensive testing: Use Playwright for basic functionality and Applitools for visual regression.
- Start with manual testing to identify key areas for automation.
- Pay attention to performance and usability aspects during testing.
I hope this helps
Hi @Raghav Thank you very much for the tutorial.
Can we do Database testing using playwright?
Ex:-Connect to DB , run query and verify the results
Playwright is used for testing on browsers, so I believe it will not be an ideal tool for database testing in specific
@Raghav Playwrite can be used to automate Mobile apps ? Android and iOS ?
Aditya
Playwright is primarily designed for automating web browsers, not mobile apps. However, it does provide some mobile-related features through its browser emulation capabilities.
Playwright allows you to emulate mobile devices using its `browserType.launch` method with the `--mobile` flag. This enables you to simulate mobile devices, such as iPhones or Android phones, within a desktop browser. While this is useful for testing mobile-responsive web applications, it's not the same as automating native mobile apps.
To automate native mobile apps, you need a framework that can interact with the mobile operating system and the app itself. Some popular alternatives for mobile app automation are:
* Appium: An open-source test automation framework that supports both Android and iOS.
* Robot Framework: A generic test automation framework that can be used with various libraries, including those for mobile app automation.
* Espresso (Android) and XCTest (iOS): Native testing frameworks provided by the respective mobile operating systems.
-
@raghav, Thanks for your guidance on new automation tools. Could you please make a video on AI Powered Test Automation Tools and how it is different from playwright. Thanks
Sure
@@RaghavPal thank you
@raghav
Hope you are doing good sir
Am a manaul tester with 9 years of exp want to switch in automation
Which tool should i learn playwright or salnium
I have. 0 coding knowledge
Hope you reply
Diwanshu
As a manual tester with 9 years of experience looking to transition into automation, choosing the right tool is crucial. Let's compare Playwright and Selenium to help you make an informed decision:
1. Playwright:
- What is Playwright? Playwright, developed by Microsoft, is a headless browser testing framework. It provides a high-level API for automating web browsers (Chrome, Firefox, and WebKit) and supports multiple programming languages (JavaScript, Python, Java, and .NET C#).
- Strengths:
- Modern Features: Playwright is designed for modern web applications and handles features like single-page applications, web components, and shadow DOM efficiently.
- Fast Performance: It offers high-speed execution, making it suitable for complex scenarios.
- Auto-Wait Strategy: Playwright automatically waits for elements to be actionable, reducing the need for explicit waits.
- Cross-Browser Testing: It supports Chrome, Firefox, and WebKit.
- Considerations:
- Limited Coverage: While Playwright excels in complex web applications, its browser support is narrower compared to Selenium.
- Learning Curve: As a beginner, you'll need to learn JavaScript or another supported language.
- Smaller Community: The Playwright community is growing but not as extensive as Selenium's.
- Recommended for: Testers working on modern web applications who prioritize performance and accuracy.
2. Selenium:
- What is Selenium? Selenium is a widely adopted open-source automation framework for web testing. It supports multiple programming languages (Java, Python, C#, etc.) and has a large community.
- Strengths:
- Comprehensive Coverage: Selenium supports a wide range of browsers (Chrome, Firefox, Edge, Safari, etc.) and platforms.
- Versatility: Its language support and community make it versatile and reliable.
- Strong Community: Selenium has been around for years, and its community provides extensive resources and support.
- Considerations:
- Explicit Waits: Selenium requires explicit waits (implicit, explicit) to handle dynamic elements, which can lead to flaky tests.
- Handling Modern Features: While Selenium can handle modern web features, it may not be as efficient as Playwright.
- Learning Curve: Learning Java or another language might be necessary.
- Recommended for: Testers who need comprehensive browser coverage, scalability, and flexibility.
3. Decision Factors:
- Prioritize Coverage: If broad browser support is critical, consider Selenium.
- Modern Applications: For modern web apps, Playwright's features shine.
- Coding Knowledge: Since you're starting from scratch, both tools require learning, but Selenium might be more familiar due to its longevity.
I load playwrights from visual studio code , it says this extensions is enabled globally. What should I do
When you load the Playwright extension from Visual Studio Code, and it says that the extension is enabled globally, this means that the Playwright extension is installed globally on your computer, and not just in your Visual Studio Code workspace.
There are a few reasons why you might want to load the Playwright extension from Visual Studio Code instead of using the global installation:
* To be able to use the Playwright extension in multiple Visual Studio Code workspaces.
* To be able to use the latest version of the Playwright extension, even if you have an older version of the Playwright extension installed globally.
* To be able to use the Playwright extension with a specific version of Node.js, even if you have a different version of Node.js installed globally.
To load the Playwright extension from Visual Studio Code, follow these steps:
1. Open Visual Studio Code.
2. Click on the **Extensions** icon in the sidebar.
3. Search for "Playwright" in the extensions marketplace.
4. Click on the **Install** button next to the Playwright extension.
5. Once the extension is installed, click on the **Reload** button to reload Visual Studio Code.
Once the Playwright extension is loaded from Visual Studio Code, you can start using it to test your web applications.
If you are still getting the error message "This extension is enabled globally" after following these steps, then you can try the following:
* Close Visual Studio Code and reopen it.
* Try restarting your computer.
* Uninstall the Playwright extension from Visual Studio Code and then reinstall it.
I don’t know coding and it’s becoming difficult for me to learn automation. How can I learn could you please help me
Ok, Let's break down the problem into smaller, manageable steps. Here's a step-by-step guide to help you learn automation:
Step 1: Identify Your Goals
* What do you want to automate? (e.g., tasks at work, personal tasks, data entry, etc.)
* What benefits do you expect from automation? (e.g., save time, increase efficiency, reduce errors, etc.)
Step 2: Choose an Automation Tool
* Research popular automation tools that don't require extensive coding knowledge
Step 3: Learn the Basics of the Chosen Tool
Step 4: Understand Basic Concepts
Step 5: Practice and Build Simple Automations
Step 7: Apply Automation to Real-World Scenarios
Thank you again for this series, very useful and very easy to follow. Currently we use Jest to do component-testing. Is it possible to do component testing with Playwright?
Nicolae
Yes, it is possible to do component testing with Playwright. Playwright has a built-in feature for component testing, which was introduced in version 1.22.0.
To use Playwright for component testing, you need to create a test script that imports and tests your components. You can use the `mount()` method to mount the component to the DOM and then interact with the component using Playwright's methods.
Here is an example of a Playwright component test script:
```
import { test, expect } from '@playwright/test';
import { MyComponent } from './MyComponent';
test('MyComponent should render correctly', async () => {
const component = await test.mount(MyComponent);
expect(component).toBeInTheDocument();
expect(component).toHaveTextContent('Hello, world!');
});
```
To run the component test script, you can use the following command:
```
npx playwright test
```
Playwright will run the test script and generate a report. The report will show you whether the test passed or failed, as well as any errors that occurred.
Playwright component testing is still under development, but it is already a powerful tool for testing React components. Playwright provides a number of features that make it a good choice for component testing, such as:
*Support for multiple browsers.* Playwright supports a variety of browsers, including Chromium, Firefox, and WebKit. This allows you to test your components in multiple browsers without having to write separate tests for each browser.
*Parallel execution.* Playwright can run tests in parallel, which can significantly reduce the time it takes to run your tests.
*Reporting.* Playwright generates a report that shows you the results of your tests. The report includes information such as whether the test passed or failed, as well as any errors that occurred.
If you are looking for a tool to test your React components, Playwright is a good option to consider. It is a powerful tool that provides a number of features that make it a good choice for component testing.
I hope this helps
Hi Raghav. I see this course is using JavaScript, but wondering if you also have another course using python? Thank you. Superb work!
Will upload soon
And how about Java please?😘😘
I will plan
very understandable, thank you
You're very welcome
Hi Sir, in playwright JavaScript bdd framework ..I have written feature file and step definitions ..But when I click on feature file step it should navigate implementented step definition s..can you please help to me
Sanjeev
To navigate from a step in your feature file to its corresponding step definition, follow these steps:
1. Configure VSCode Settings:
- Open your project in Visual Studio Code (VSCode)
- To resolve any issues with displaying undefined steps in the feature file, update the Cucumber settings in the VSCode user settings file
- Specify the correct paths to the feature files and step definition files in your settings
2. Install the Cucumber Extension:
- Make sure you have the "Cucumber (Gherkin) Full Support" extension installed in VSCode
- You can find it in the VSCode Extensions marketplace
3. Create a `.vscode` Folder:
- In your project folder, create a `.vscode` folder (at the root level, not in any subfolder)
4. Create a `settings.json` File:
- Inside the `.vscode` folder, create a `settings.json` file
- Add the following configuration (adjust paths as needed):
```json
{
"cucumberautocomplete.steps": ["steps/*js"],
"cucumberautocomplete.syncfeatures": "features/*feature",
"cucumberautocomplete.strictGherkinCompletion": true
}
```
Replace `"steps/*js"` with the actual path to your step definition files and `"features/*feature"` with the path to your feature files
5. Reopen the Project Folder in VSCode:
- Close and reopen the folder where `.vscode` is located to apply the settings
Now, when you right-click on a step in your feature file, it should navigate to the corresponding step definition
-
@@RaghavPal thanks sir I will try it..
@@RaghavPal Hi sir I have tried same steps but it is not navigating
Let's break down the problem step by step:
Step 1: Verify Feature File and Step Definitions
* Can you confirm that you have written a feature file (e.g., `example.feature`) with scenarios and steps?
* Have you implemented the corresponding step definitions in a separate file (e.g., `example.steps.js`)?
Step 2: Check Feature File Syntax
* Make sure the feature file syntax is correct. A typical feature file should start with the `Feature` keyword, followed by a description, and then scenarios with steps.
* Verify that each step in the feature file starts with a keyword like `Given`, `When`, `Then`, `And`, or `But`.
Step 3: Ensure Step Definitions are Correctly Linked
* In your step definitions file (e.g., `example.steps.js`), make sure you have exported the step definitions using the `module.exports` syntax.
* Verify that the step definitions are correctly linked to the feature file steps using the `Given`, `When`, `Then`, `And`, or `But` keywords
Step 4: Check Playwright Configuration
* Ensure that you have correctly configured Playwright to use your feature files and step definitions
* Check your `playwright.config.js` file (or equivalent) to ensure that it points to the correct location of your feature files and step definitions
Step 5: Verify Clicking on Feature File Step
* When you click on a step in the feature file, Playwright should navigate to the corresponding step definition
* If this is not happening, try checking the console output for any error messages that might indicate the issue
Step 6: Check for Duplicate Step Definitions
* If you have multiple step definitions files, ensure that there are no duplicate step definitions that might be causing the issue
Step 7: Try Debugging
* Try debugging your step definitions by adding console logs or using a debugger to see if the step definitions are being executed correctly
* This can help you identify if the issue is with the step definitions themselves or with the linking between the feature file and step definitions
If you've checked all of these steps and are still having issues, please provide more details about your project setup, feature file, and step definitions, and I'll do my best to help you troubleshoot the problem
-
@@RaghavPal thanks alot sir
Hello Raghav sir,
Could you please help me in below question,
I want to send Playwright test reports to slack channel using typescript?
Amar
Certainly, I can assist you in sending Playwright test reports to a Slack channel using TypeScript. Here's a step-by-step guide to achieve this:
1. **Install Required Packages:**
Install the necessary packages for Playwright and Slack interactions using npm:
```bash
npm install playwright @slack/web-api
```
2. **Configure Slack Web API:**
Create a Slack app and obtain the OAuth token for your Slack bot. Store this token securely as an environment variable named `SLACK_BOT_USER_OAUTH_TOKEN`.
3. **Create the Playwright Report Sender:**
Create a TypeScript file (e.g., `playwrightSlackReporter.ts`) to handle the report generation and sending process:
```typescript
import { defineConfig } from '@playwright/test';
import { SlackClient } from '@slack/web-api';
export async function sendPlaywrightReportToSlack(report: string, channels: string[]) {
const slackClient = new SlackClient({ token: process.env.SLACK_BOT_USER_OAUTH_TOKEN });
for (const channel of channels) {
const message = {
channel: channel,
text: `Playwright Test Report: ${report}`,
};
await slackClient.chat.postMessage(message);
}
}
```
4. **Integrate with Playwright Configuration:**
In your Playwright test configuration file (e.g., `playwright.config.ts`), import the report sender function and use it to send the report after test execution:
```typescript
import { defineConfig } from '@playwright/test';
import { sendPlaywrightReportToSlack } from './playwrightSlackReporter';
export default defineConfig({
reporter: [
['html', { outputFile: 'test-results.html' }],
async ({ config, report }) => {
const channels = ['#playwright-tests', '#dev-reports'];
await sendPlaywrightReportToSlack(report.toString(), channels);
},
],
});
```
5. **Run Playwright Tests:**
Execute your Playwright tests using the `npx playwright test` command. The generated test reports will be sent to the specified Slack channels upon test completion.
Hello , your videos are always useful. I would like to know if you have series of Playwright with .Net please similar to Node project series with Playwright? Thanks
Not yet Meenal.. will plan
Hi sir..How to highlight text in playwright javascript ..I have taken text locator..I just want to highlight that text..Can you suggest on this sir
Sanjeev
To highlight text in Playwright JavaScript, you can use the following steps:
1. **Get the text locator.** You can use the `querySelector()` method to get the text locator for the text that you want to highlight.
2. **Create a new `Highlight` object.** You can use the `new Highlight()` constructor to create a new `Highlight` object.
3. **Set the text locator for the `Highlight` object.** You can use the `setLocator()` method to set the text locator for the `Highlight` object.
4. **Highlight the text.** You can use the `highlight()` method to highlight the text.
The following code snippet shows how to highlight text in Playwright JavaScript:
```javascript
// Get the text locator.
const textLocator = await page.querySelector('.my-text');
// Create a new Highlight object.
const highlight = new Highlight();
// Set the text locator for the Highlight object.
highlight.setLocator(textLocator);
// Highlight the text.
highlight.highlight();
```
You can also use the `highlight()` method to highlight text for a specific duration. To do this, you can pass a duration in milliseconds to the `highlight()` method.
The following code snippet shows how to highlight text for a specific duration in Playwright JavaScript:
```javascript
// Get the text locator.
const textLocator = await page.querySelector('.my-text');
// Create a new Highlight object.
const highlight = new Highlight();
// Set the text locator for the Highlight object.
highlight.setLocator(textLocator);
// Highlight the text for 5 seconds.
highlight.highlight(5000);
```
Once you have highlighted the text, you can use the `unhighlight()` method to unhighlight the text.
The following code snippet shows how to unhighlight text in Playwright JavaScript:
```javascript
// Get the text locator.
const textLocator = await page.querySelector('.my-text');
// Create a new Highlight object.
const highlight = new Highlight();
// Set the text locator for the Highlight object.
highlight.setLocator(textLocator);
// Highlight the text.
highlight.highlight();
// Unhighlight the text.
highlight.unhighlight();
```
Hi raghav, is this playwright automation supports to react application ? I want to use playwright automation
Playwright is good choice for automating React applications. Here's why:
1. Targeting React Components:
- With Playwright, you can easily target React components to test modular UIs
- It ensures test reliability and speed, allowing developers to focus on building rather than debugging.
2. Features of Playwright:
- Cross-Browser Compatibility: Playwright works with modern rendering engines (Firefox, WebKit, Chromium).
- Headless and GUI Modes: Launch browsers in GUI mode for development/debugging or headless mode for faster testing.
- Cross-Language Support: Access the Playwright API from JavaScript, TypeScript, Python, .NET, and Java.
- Mobile Web Evaluation: Supports Chrome for Android and Mobile Safari native emulation.
- CI Integration: Easily integrate with CI environments for continuous testing.
- Playback and Codegen Recording: Create test scripts by recording interactions with the browser
3. Unified Testing Strategy:
- Playwright helps create a unified testing strategy across different levels, including end-to-end testing for React applications
Feel free to explore Playwright for your React projects-it's a powerful tool for automating web interactions
Do a POC before finalising the tool
-
Hi Raghav , Should i choose javascript or python to learn playwright?.which will have better opportunities in the market? I have experience in selenium java. Please give your opinion.
Sourabh
Here's my opinion on choosing JavaScript or Python for Playwright, considering market opportunities and your Selenium Java experience:
Overall, both JavaScript and Python offer excellent support for Playwright and have strong job market prospects. The best choice depends on your preferences, experience, and career goals:
Factors to Consider:
- JavaScript:
- Pros:
- Native language of Playwright, providing seamless integration and potential performance benefits.
- Extensive ecosystem of libraries, tools, and resources for web development.
- Strong demand in both web development and automation testing.
- Cons:
- Less familiar to you based on your Java background.
- Dynamic typing might require more testing discipline.
- Python:
- Pros:
- Widely used for automation testing, with a large community and support.
- Known for readability and ease of learning.
- Extensive libraries for data manipulation and analysis.
- Cons:
- Not the native language of Playwright, potentially introducing some overhead.
Recommendations:
- If you're comfortable with JavaScript or interested in expanding your web development skills, it's an excellent choice for Playwright.
- If you prefer a language with clear syntax and extensive libraries for testing and data handling, Python is a strong option.
- Your experience with Selenium Java gives you a foundation for understanding testing concepts, making the transition to either language manageable.
Market Opportunities:
- Both JavaScript and Python have significant demand for automation testing roles.
- Consider the specific industries and companies you're interested in to assess their tech stacks and preferred languages.
Additional Tips:
- Try both languages through tutorials or small projects to get a feel for their syntax and style.
- Evaluate your comfort level with dynamic vs. static typing.
- Consider your long-term career goals and potential for growth in each language.
- Explore the Playwright documentation and community resources in both languages to assess their support and ease of use.
Ultimately, the best choice is the one that aligns with your skills, interests, and career aspirations. Both JavaScript and Python are powerful tools for Playwright, and you can achieve great results with either language.
@@RaghavPal Thank you.I got a clear difference between them.Thanks for explaining all the points.
Hi Raghav, Thanks for this series. Please answer my doubt: I have an application built using angular and typescript. Can we use playwright to automate angular application with Java OR is it mandatory to use Javascript in playwright?
Hi, you can use Playwright with Java
Hi @Raghav, Thank you so much for this tutorial. When are you going to do the video on the page object model for this playlist?
I will plan in some time
Hi @Raghav, when I ran this command npx playwright test .\tests\AnnotationsAndTags.spec.js --project=chrome --grep "@smoke", I got the attached error " Running 0 tests using 0 workers
Error: Requiring @playwright/test second time,
First:
Error:
at Object. (C:\Users\oluse\OneDrive\Desktop\Playwright
ode_modules\@playwright\test\lib\index.js:64:33)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Object.t..tu._extensions. [as .js] (C:\Users\oluse\OneDrive\Desktop\Playwright
ode_modules\@playwright\test\lib\utilsBundleImpl.js:16:1010)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (C:\Users\oluse\OneDrive\Desktop\Playwright
ode_modules\@playwright\test\index.js:17:13)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Object.t..tu._extensions. [as .js] (C:\Users\oluse\OneDrive\Desktop\Playwright
ode_modules\@playwright\test\lib\utilsBundleImpl.js:16:1010)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
Second:
at Object. (C:\Users\oluse\OneDrive\Desktop\Playwright\tests
ode_modules\@playwright\test\lib\index.js:59:11)
at Object. (C:\Users\oluse\OneDrive\Desktop\Playwright\tests
ode_modules\@playwright\test\index.js:17:13)
at Object. (C:\Users\oluse\OneDrive\Desktop\Playwright\tests\AnnotationsAndTags.spec.js:3:13)". Kindly assist
which one is better between selenium and cypress and playwright ?
Hi Anupam, it will depend on your needs, requirements and features you need. To help you make the decision
Selenium vs Cypress - th-cam.com/video/2anO9t6-oT8/w-d-xo.html
Cypress vs Playwright - th-cam.com/video/cixkQHNkoZ4/w-d-xo.html
Hi raghav , javascript is mandatory to learning playwright tool. Current I am using selenium- Java. Java is better ya learn separate javascript language? & Then after learn playwright. This is a way ?
Shiv
While JavaScript is the primary language for Playwright, it's not strictly mandatory to learn it extensively before diving in, especially if you have a Java background. Here are your options:
*1. Utilize Playwright Java:*
- Playwright offers a Java API, allowing you to write tests in Java while leveraging Playwright's features.
- This approach aligns with your existing Java experience.
- Example:
```java
import com.microsoft.playwright.*;
public class ExampleTest {
public static void main(String[] args) {
try (Playwright playwright = Playwright.create()) {
Browser browser = playwright.chromium().launch();
Page page = browser.newPage();
page.navigate("playwright.dev");
// ... your test actions
}
}
}
```
*2. Consider Playwright for Java's JUnit 5 Extension:*
- This extension streamlines Playwright test integration into JUnit 5 test suites.
- It provides annotations for test setup and execution.
*3. Explore Playwright for Java's Gradle Plugin:*
- If you use Gradle, this plugin simplifies Playwright dependency management and test execution.
*4. Learn Basic JavaScript (Recommended):*
- Even with Playwright Java, a basic understanding of JavaScript syntax and concepts is beneficial:
- Interact with browser APIs more effectively.
- Understand Playwright's underlying mechanisms better.
- Troubleshoot issues more efficiently.
- Potentially contribute to Playwright's open-source development.
*Key Considerations:*
- *Learning Curve:* Playwright's Java API is relatively new and less mature compared to its JavaScript counterpart. Expect some learning curve and potential limitations.
- *Long-Term Benefits:* Investing in JavaScript knowledge can expand your testing capabilities and open doors to other tools and frameworks in the web development ecosystem.
*Recommendations:*
- *Start with Playwright Java:* Leverage your Java experience to quickly adopt Playwright's core features.
- *Gradually Learn JavaScript:* Incrementally introduce JavaScript concepts as needed for deeper understanding and flexibility.
- *Explore JavaScript Resources:* Utilize online tutorials, courses, and documentation to learn JavaScript basics.
Thank you very much Sir
Most welcome
Thank you Raghaf for this tutos, i have a question, is playwright compatible with desktop application ?
Yes, Playwright is compatible with desktop applications. While Playwright is primarily known for its web automation capabilities, it also supports automating desktop applications across different platforms.
Playwright provides a unified API that allows you to automate web browsers (Chrome, Firefox, WebKit) as well as desktop applications using the same programming language and codebase. It supports automating desktop applications on Windows, macOS, and Linux.
To automate desktop applications using Playwright, you would typically use the appropriate API methods and functions provided by Playwright for interacting with the user interface elements, performing actions, and retrieving information from the application.
Here's a high-level example of automating a desktop application with Playwright:
```javascript
const { chromium } = require('playwright');
(async () => {
const app = await chromium.launch();
const context = await app.newContext();
const page = await context.newPage();
// Navigate to the desktop application
await page.goto('your-desktop-app-url');
// Perform actions on the application, e.g., clicking buttons, filling forms, etc.
await page.click('#button-id');
await page.fill('#input-field-id', 'Hello, World!');
// Retrieve information from the application, e.g., reading text, getting values, etc.
const labelText = await page.innerText('#label-id');
console.log('Label Text:', labelText);
await app.close();
})();
```
This is just a basic example, and the specific methods and APIs you use will depend on the desktop application and its UI framework. Playwright supports popular UI frameworks like Win32, WPF, UWP on Windows, and Cocoa on macOS.
By leveraging Playwright's cross-browser and cross-platform capabilities, you can write automation scripts that cover both web and desktop applications, providing a unified testing experience
Hi Sir. Please do a comparison between Selenium and Playwright so that a fresher like me can get overall idea.
Noted Abhi
Sir please make video on playwright how to deploy playwright code on vercel or any other hosting provider please make video on this topic sir please
I will plan Tausif
sir please reply, How can i block notification in playwright , poup notification block
Hi, this can help
playwrightsolutions.com/network-abort-request-playwright-tutorial-part-59/
Is there any way that this could be used for ColdFusion.
Hi Nathan
Playwright is a tool that automates browsers, so it can be used for web applications developed with any language as long as it is accessible through a browser.
In the case of ColdFusion, if the application can be accessed through a web browser, then Playwright can be used to automate testing or other tasks. Playwright provides support for popular browsers such as Chrome, Firefox, and Safari, and can also be used with headless browsers.
However, if you're looking to automate tasks within ColdFusion itself, then Playwright may not be the most suitable tool. In that case, you may want to explore other automation tools that are designed specifically for ColdFusion, such as CFML-based automation frameworks or tools.
Thanks Sirji...🙏
Most welcome
Hi Raghav sir, can you please let me know what are the pre-requisites that I need to learn before starting learning Playwright? I'm preferred to choose C# programming language but want to know what more I need to learn please in order to perform a smooth E2E testing.
Ashish
To get started with Playwright and perform smooth End-to-End (E2E) testing using C#, here are the pre-requisites you should consider:
1. Programming fundamentals:
* You should have a good grasp of programming concepts, such as variables, data types, control structures, functions, and object-oriented programming (OOP) principles.
2. C# programming language:
* You've mentioned you prefer C#, so you should have a solid understanding of C# syntax, features, and best practices.
* Familiarize yourself with C# versions 8.0 or higher, as Playwright supports these versions.
3..NET Core:
* Playwright is built on top of.NET Core, so it's essential to understand the basics of.NET Core, including:
+.NET Core framework
+ NuGet packages
+ Dependency injection
+ Configuration and settings
4. Web development basics:
* Understand how web applications work, including:
+ HTML (structure and syntax)
+ CSS (styling and layout)
+ JavaScript (client-side scripting)
+ HTTP requests and responses
+ Web browsers and their rendering engines
5. Selenium WebDriver:
* Although Playwright is an alternative to Selenium, understanding Selenium's concepts and architecture will help you appreciate Playwright's design and features.
* Familiarize yourself with Selenium's WebDriver API and how it interacts with browsers.
6. Browser automation:
* Learn about browser automation concepts, such as:
+ Browser instances and sessions
+ Element interaction (e.g., clicking, filling forms)
+ Waits and timeouts
+ Handling alerts and pop-ups
7. Testing frameworks and principles:
* Understand testing concepts, such as:
+ Test-driven development (TDD)
+ Behavior-driven development (BDD)
+ Unit testing, integration testing, and E2E testing
* Familiarize yourself with popular testing frameworks, such as NUnit, xUnit, or MSTest.
8. Playwright-specific knowledge:
* Once you have a solid foundation in the above areas, dive into Playwright's documentation and learn about:
+ Playwright's architecture and design principles
+ Browser types and launch modes
+ Frames, contexts, and pages
+ Element handling and interaction
+ Waits, timeouts, and retries
+ Error handling and debugging
-
@@RaghavPal Thank you so much for explaining me in such a detailed manner, now I can confidently start my Playwright journey with C# programming language.
Thanks a ton once again for sharing this information with me sir.
I'm really sorry to trouble you again with my one more query please, is this the same with the "Python" programming language too or is there is any difference when using Python with Playwright please?
Ashish
Playwright provides a unified API across multiple programming languages, including C#, Python, Java, and Node.js. This means that the core concepts, such as:
* Launching browsers
* Creating browser contexts
* Navigating pages
* Interacting with elements
* Handling events
are similar across all supported languages.
Identify the differences
While the core concepts are similar, there are some differences in using Playwright with Python compared to C#:
* Syntax: The most obvious difference is the syntax of the programming languages themselves. Python's syntax is more concise and flexible, while C#'s syntax is more verbose and strict.
* Library usage: In C#, you would use the `Microsoft.Playwright` NuGet package, whereas in Python, you would use the `playwright` library installed via pip.
* Async/await: Python's async/await syntax is more concise and expressive than C#'s, which can make the code look slightly different.
* Error handling: Python's error handling mechanisms, such as try-except blocks, differ from C#'s try-catch blocks.
In summary, while there are some differences in using Playwright with Python compared to C#, the core concepts and API remain the same. If you learn Playwright with C#, you can easily adapt to using it with Python, and vice versa. The main differences lie in the syntax, library usage, async/await, and error handling mechanisms of the respective programming languages.
I hope this step-by-step breakdown helps clarify the differences and similarities between using Playwright with C# and Python
-
@@RaghavPal Thank you so much for explaining me in such a detailed manner, now I can confidently start my Playwright journey with any programming language my company offers to choose.
Thanks a ton once again for sharing this information with me sir.
3:45 headless and headed mode
9:46 flaky tests
Thanks for adding
how to find multiple elements using python? which locator or selector should i need?
In Playwright for Python, you can find multiple elements using the `locator.all()` method. This allows you to locate and interact with multiple elements that match a specific selector. Let's explore how to use it:
1. Creating a Locator:
- First, create a locator using the `page.locator()` method. You can specify a CSS selector, text, or other attributes to identify the elements you want to find.
- For example:
```python
# Create a locator for all buttons with a specific class
button_locator = page.locator('.my-button-class')
```
2. Finding Multiple Elements:
- Once you have the locator, use the `all()` method to get an array of locators pointing to all matching elements.
- For example:
```python
# Get all buttons with the specified class
all_buttons = await button_locator.all()
# Iterate over the buttons and perform actions
for button in all_buttons:
await button.click()
```
3. Accessing Element Properties:
- You can access properties of each element using methods like `innerText()`, `textContent()`, or other relevant methods.
- For example:
```python
for button in all_buttons:
button_text = await button.innerText()
print(f"Button text: {button_text}")
```
Remember to replace `.my-button-class` with your actual CSS selector or other attributes relevant to your use case. The `all()` method returns an array of locators, allowing you to interact with multiple elements efficiently.
..
Thank you so much for the detailed answer@@RaghavPal
Hi Raghav, what would be the future of this tool.is this overtake selenium
Hi Alim, Playwright has very good features and is useful in Automation, Selenium is here since a long time and has a huge community, So it may not be right to compare these 2
I will suggest that you learn the skills and then decide what works best for you
@@RaghavPal ,Thanks for your reply.just make vedio of comparision for Sel vs Playright that would be useful.
Hi' I already writing automaticn tests using IDE = VSCode and robot framework. my question is, can I use the same vscode for trying out playwright opening a new folder or a new workspace in vscode? thanks
Péter
Let's break down the problem step by step:
Step 1: Understand the current setup
You are currently using VSCode (Visual Studio Code) as your Integrated Development Environment (IDE) to write automatic tests using the Robot Framework.
Step 2: Identify the new requirement
You want to try out Playwright, a browser automation framework, and you're wondering if you can use the same VSCode instance to do so.
Step 3: Consider the options
To use Playwright, you have two options:
a. Create a new folder within the existing workspace: You can create a new folder within your existing VSCode workspace and start writing Playwright tests there. This approach allows you to keep your Robot Framework tests and Playwright tests separate, but still within the same workspace.
b. Create a new workspace in VSCode: You can create a brand new workspace in VSCode, specifically for your Playwright tests. This approach allows you to keep your Robot Framework tests and Playwright tests completely separate, with their own distinct workspaces.
Step 4: Evaluate the feasibility
Both options are feasible, and VSCode supports multiple folders and workspaces. You can easily create a new folder or workspace in VSCode and start writing Playwright tests.
Step 5: Choose the approach
The choice between options a and b depends on your personal preference and how you want to organize your projects. If you want to keep your Robot Framework and Playwright tests separate but still accessible from the same VSCode instance, option a might be suitable. If you prefer to keep them completely separate, option b might be a better fit.
Conclusion
Yes, you can use the same VSCode instance to try out Playwright by creating a new folder or workspace. You can choose the approach that best suits your needs and start writing Playwright tests alongside your Robot Framework tests
-
@@RaghavPal thanks, figured it out on my own, already put playwright on my Mac and also run my 1st test in playwright in vscode.
Hi Raghav what is impact of playwright is going to create change in Test Automation and carrier scope
Playwright has really good features and will be a good skill set to acquire Pandu