this is the best tutoerial i've seen on this subject, thank you so much, i would have saved a lot of time only if I new about your videos, you're the best!!!
Hi, thank you for a learning session. I am curious if it is possible to manipulate web browser and desktop application within one test? If so, it would be highly appreciated to have a tutorial from you. Thank you!
Yes, it is possible to manipulate a web browser and a desktop application within one test using WebdriverIO. You can use the `multiremote` function to create a new instance of WebdriverIO that can control multiple browsers and applications. Here is an example of how you can use the `multiremote` function to manipulate a web browser and a desktop application within one test: ``` const { multiremote } = require('webdriverio'); (async () => { const browser = await multiremote({ browsers: ['chrome'], }); const app = await browser.launchApp('C:\\Program Files\\MyApplication.exe'); // Manipulate the web browser await browser.goto('www.google.com'); await browser.setValue('#q', 'webdriverio'); await browser.click('button[name="btnK"]'); // Manipulate the desktop application await app.click('button[name="myButton"]'); await browser.close(); await app.close(); })(); ``` This code will first launch a Chrome browser and an application called "MyApplication.exe". The code will then navigate to the Google search page in the browser and enter the search term "webdriverio". The code will then click on the search button. The code will then click on a button called "myButton" in the desktop application. Finally, the code will close the browser and the desktop application. I hope this helps
Harini No, the setup differs slightly for web and mobile automation in WebdriverIO: Web Automation: Use browser capabilities (browserName: 'chrome' or 'firefox'). Install a web driver service like chromedriver or geckodriver Mobile Automation: Use Appium capabilities (e.g., platformName: 'Android', appium:deviceName, appium:app) Install and configure Appium service (@wdio/appium-service) Each setup has unique configurations tailored to the platform -
If you are unable to install the webdriverio using "npm init wdio" follow these steps 1) Check if your npm is installed globally if not use command npm install -g npm 2) Use this to clean the cache related problems npm cache clean --force 3) Set your global variables properly as described in video. 4) Run npm init -y 5) Run npm init wdio --legacy-peer-deps Select less packages/dependencies so that the installation does not fail due to any extra packages that are not crucially required.
Yes, you can automate Windows-based or desktop applications with WebdriverIO. To do so, you'll need to use Windows Application Driver (WinAppDriver), which is capable of receiving and interpreting WebDriver protocol commands for Windows applications. Additionally, it's recommended to use an Appium server as a proxy for increased flexibility and better interaction with app elements Here's a brief overview of the steps involved: 1. Install WinAppDriver on your system. 2. Set up an Appium server to act as a bridge between your tests and WinAppDriver. 3. Use Accessibility Insights for inspecting elements within your application. 4. Configure your WebdriverIO project to include the Appium service. 5. Define Appium capabilities in your test scripts to instruct the server on how to interact with your application. For a detailed guide and step-by-step instructions, you can refer to resources available online that walk you through the process of setting up your first automation test scenario for a Windows app using WebdriverIO. Remember, you'll need to have Node.js installed as WebdriverIO is a Node.js-based automation framework.
Hi Amit, The error message you're seeing suggests that WebdriverIO is not able to find the configuration file it needs to run your tests. By default, WebdriverIO looks for a configuration file called wdio.conf.js in the root directory of your project. Here are some steps you can take to resolve this issue: Check that the configuration file exists in your project directory. If it doesn't exist, you'll need to create one. You can do this manually, or you can use the WebdriverIO CLI to generate a configuration file for you. To generate a configuration file using the CLI, run the following command in your terminal: npx wdio config -y This will generate a default configuration file called wdio.conf.js in your project directory. If the configuration file already exists in your project directory, make sure that it's named correctly (wdio.conf.js) and that it's located in the root directory of your project. If the configuration file exists and is named correctly, double-check that you're running the wdio command from the root directory of your project. If you're running the command from a subdirectory, WebdriverIO may not be able to find the configuration file. Once you've made any necessary changes, try running your tests again. If you're still seeing the same error message, you may need to provide more information about your project setup and configuration in order to troubleshoot further
Hai Raghav, I was struck at "Do you want add a service to your test setup?" I am not getting Chrome driver or edge driver. Can you pls help me to continue. Thanks
Thank u for your great effort as always. I have an issu, the first test what u wrote in this video has been skipped und cant find out why, i just follow every step u done. Do you maybe have any suggestions? Thank u very much
Hi Sir, I am currently in testing with webdriverio and typescript and cucumber framework, now I am interested in learning SDET as a pack , what do you suggest? Is it good to learn for senior levels ?
Anitha Becoming a Software Development Engineer in Test (SDET) can be a great career move especially for senior-level professionals. Let's explore what SDET entails and why it might be a good fit for you: 1. What is SDET? - SDET stands for Software Development Engineer in Test. It's a role that bridges the gap between software development and testing - SDETs are skilled in both coding and software testing, making them valuable contributors to the software development lifecycle 2. Why SDET? - Organizations seek SDETs because they can handle both automation and testing - SDETs have deep knowledge of software engineering, SDLC, and STLC processes - They're in high demand due to their ability to ensure quality while automating processes 3. When Is SDET Needed? - Consider SDET when: - The software system is robust and challenging to manage manually - Data-driven testing with complex scenarios and large datasets is required - Continuous monitoring of the entire process is essential 4. SDET vs. Other Roles: - SDET vs. QA: - QA focuses on test execution, while SDETs participate in project planning, code review, and automation - SDET vs. Developer: - SDETs have knowledge of software architecture but aren't directly involved in development - They ensure better quality standards and less defective software - SDET vs. Automation Engineer: - SDETs and automation engineers are often treated as the same - SDETs review code, write unit tests, and analyze test coverage 5. Career Path: - Junior SDET (0-3 years): - Create automation test scripts, write test cases, and learn new tools. - Senior SDET (3-7 years): - Verify acceptance criteria, analyze root causes, review code, and create/update automation scripts 6. Skills Needed: - Hands-on experience with multiple test automation tools and frameworks - Proficiency in both white-box and black-box testing - Understanding of software development principles In summary, learning SDET can enhance your career, especially if you're interested in both coding and testing. It's a valuable skill set for senior-level professionals like yourself -
Hi Kalyan not separate video, but if you follow all the sessions with hands-on you will be able to understand and answer most questions. If you like after watching and hands-on can try some online questions
Testing the performance of a login process with multiple users is an important step to ensure that your website or application can handle concurrent logins efficiently. Here are some instructions to guide you through the process: 1. Define Your Test Scenario: - Decide on the number of concurrent users you want to simulate during the test. For example, you might choose 10, 50, or 100 users. - Determine the login flow you want to test. Consider scenarios like: - New users registering and logging in. - Existing users logging in. - Users with different roles (e.g., regular users, admins) logging in. 2. Choose a Load Testing Tool: - There are several load testing tools available that can simulate multiple users accessing your website simultaneously. Some popular ones include: - Apache JMeter: A powerful open-source tool for load testing. - Gatling: Another open-source tool specifically designed for performance testing. - Locust: A Python-based load testing framework. - k6: A modern, developer-friendly load testing tool. - Pick a tool that suits your requirements and expertise. 3. Create Test Scenarios: - In your chosen load testing tool, create test scenarios that simulate the login process. - Define the following parameters for each user: - Username - Password - Any additional data required for login (e.g., CSRF tokens, session IDs) - Set up the test to run with the desired number of concurrent users. 4. Record or Script the Login Flow: - If your load testing tool supports recording, use it to record the login flow while manually logging in as a user. - Alternatively, write custom scripts to simulate the login process. These scripts should include HTTP requests for: - Navigating to the login page - Submitting login credentials - Handling any redirects or subsequent requests (e.g., fetching user data after login) 5. Configure Test Parameters: - Set the ramp-up time (how quickly users are added) and duration for the test. - Configure any additional settings, such as think time (delay between requests) and assertions (validating successful login). 6. Execute the Load Test: - Run the load test with the defined scenarios. - Monitor server resources (CPU, memory, database connections) during the test. - Observe response times, error rates, and throughput. 7. Analyze Results: - Review the load test results. Look for: - Response times: How long it takes for users to log in. - Error rates: Any failed logins or unexpected behavior. - Server resource utilization: Ensure your infrastructure can handle the load. - Identify bottlenecks (e.g., slow database queries, inefficient code) and address them. 8. Optimize and Retest: - Based on the results, optimize your login process if needed. - Retest after making improvements to validate the changes. Remember that load testing is essential for identifying performance bottlenecks and ensuring your application can handle real-world usage. Good luck with your performance testing
Hi Uzair No, WebDriverIO is primarily designed for automating web browsers and interacting with web pages using standard HTTP protocols. It does not have built-in support for testing WebSocket connections or performing WebSocket chat testing WebSocket is a different protocol than HTTP and requires a specialized library or tool to establish and manage the WebSocket connections. WebDriverIO, being focused on browser automation, does not have direct capabilities to handle WebSocket connections. To test WebSocket chat functionality, you would need to use a testing framework or library that supports WebSocket communication. There are specific libraries available for WebSocket testing, such as 'ws', 'socket.io-client', or 'websocket-client'. These libraries provide the necessary functionality to establish and interact with WebSocket connections. You can incorporate these WebSocket libraries into your WebDriverIO automation framework to perform WebSocket chat testing. You would need to handle the WebSocket connections separately from WebDriverIO's browser automation capabilities. This may involve establishing WebSocket connections, sending and receiving WebSocket messages, and asserting the expected behavior of the chat functionality. By combining the WebSocket testing library with WebDriverIO, you can simulate chat interactions and verify the correctness of WebSocket-based chat functionality within your automation tests
hello sir i have one issue , when i try to run test this time "? Could not execute "run" due to missing configuration, file "wdio[.js/.ts]" not found! Would you like to create one? (y/N) " this message was show, how can i resolve this.
Hi Shubham The error message you encountered suggests that WebDriverIO couldn't find the configuration file (wdio.js or wdio.ts) required to run your tests. To resolve this issue, you can follow these steps: 1. Make sure you have a WebDriverIO configuration file in your project. By default, the configuration file is named `wdio.conf.js` for JavaScript projects or `wdio.conf.ts` for TypeScript projects. 2. If you don't have the configuration file, you can create one by running the following command in your project's root directory: - For JavaScript: `npx wdio config -y` - For TypeScript: `npx wdio config tsconfig -y` This command will generate a basic configuration file with default settings. 3. After creating the configuration file, try running your tests again. The error message should no longer appear, and WebDriverIO should be able to locate and use the configuration file. If you already have a configuration file and the error persists, please make sure the file is correctly named and located in the root directory of your project. Additionally, ensure that you are running the tests from the correct directory. By resolving the missing configuration issue, you should be able to run your WebDriverIO tests without encountering the error message
Hi Vasanth The error you are getting is because WebdriverIO is unable to find the local issuer certificate. This can happen for a few reasons: * The certificate may not be installed on your machine. * The certificate may be expired. * The certificate may be corrupt. To fix this, you need to make sure that the certificate is installed on your machine and that it is valid. You can do this by following these steps: 1. Locate the certificate file. The certificate file is typically located in the `/etc/ssl/certs` directory on Linux or macOS, or the `C:\Windows\System32\CertStore\LocalMachine\ROOT` directory on Windows. 2. Import the certificate into your keystore. You can use the `keytool` command to import the certificate into your keystore. For example, to import the certificate into the default keystore on Linux or macOS, you would use the following command: ``` keytool -import -trustcacerts -alias -file ``` * `keytool` is the Java keytool utility. * `-import` is the import command. * `-trustcacerts` specifies that the certificate should be trusted. * `-alias` is the alias for the certificate. * `-file` is the path to the certificate file. 3. Verify that the certificate is valid. You can use the `openssl` command to verify the certificate. For example, to verify the certificate on Linux or macOS, you would use the following command: ``` openssl verify -CAfile ``` * `openssl` is the OpenSSL command-line tool. * `verify` is the verify command. * `-CAfile` is the path to the certificate file. * `` is the URL of the website that the certificate is for. If the certificate is valid, you should not see any errors. If you are still getting the error after following these steps, you may need to contact your system administrator for help.
Hi, when i run npm run wdio command i get following error. i followed your steps twice but same error. what could be the probem . thanks in advance. Opening in existing browser session. [0-0] 2023-06-16T15:11:01.524Z ERROR webdriver: Request failed with status 500 due to unknown error: unknown error: Chrome failed to start: exited normally. [0-0] (unknown error: DevToolsActivePort file doesn't exist) [0-0] (The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.) [0-0] 2023-06-16T15:11:01.525Z ERROR webdriver: unknown error: unknown error: Chrome failed to start: exited normally. [0-0] (unknown error: DevToolsActivePort file doesn't exist) [0-0] (The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.) [0-0] at getErrorFromResponseBody (file:///C:/Projects/webdriverio_project1/node_modules/webdriver/build/utils.js:194:12)
HI Haider The error message you are getting indicates that Chrome failed to start. There are a few possible reasons for this: * The ChromeDriver binary is not installed or is not in the path. * The ChromeDriver binary is not compatible with the version of Chrome that you are using. * There is a problem with your Chrome installation. To troubleshoot this issue, you can try the following: * Make sure that the ChromeDriver binary is installed and is in the path. You can download the ChromeDriver binary from the ChromeDriver website: chromedriver.chromium.org/downloads. * Check the compatibility of the ChromeDriver binary with the version of Chrome that you are using. You can find the version of Chrome that you are using by opening Chrome and going to `Help > About Google Chrome`. * Try reinstalling Chrome. If you have tried all of these things and you are still getting the error, then you may need to contact the WebdriverIO developers for help. Here are some additional things you can try: * Restart your computer. * Clear your Chrome browsing data. * Run Chrome in compatibility mode.
@@RaghavPal thanks alot , i can run it fine in firefox so i believe its chrome which has the problem. I will try your solutions and see if i can fix chrome issue
Hi Archana To run debug in WebdriverIO, you can use the debug command-line option when running your tests. Here's an example of how you can use it: npx wdio run wdio.conf.js --spec ./path/to/spec/file.js --debug This will start the WebdriverIO test runner in debug mode, which will pause execution at the beginning of your test. You can then use your browser's DevTools to step through your code and debug any issues. You can also set breakpoints in your code using the debugger statement, like this: it('should do something', () => { // Some code here debugger; // More code here }); When the debugger statement is hit during execution, the browser will pause and allow you to debug your code using DevTools. Additionally, you can use the --inspect-brk command-line option to launch a debugger server and attach a debugger to it. Here's an example: npx wdio run wdio.conf.js --spec ./path/to/spec/file.js --inspect-brk This will start the WebdriverIO test runner with the debugger server running on port 9229. You can then attach a debugger to this server and debug your code
Archana If your WebdriverIO automation is not pausing at the debugger statement, there are a few things you can try: Make sure you have set the --debug flag when running your tests. You can do this by adding --debug to the command you use to run your tests, like so: wdio wdio.conf.js --debug. Check that your code is actually being executed. The debugger statement will only pause execution if it is actually reached. Make sure that the code block containing the debugger statement is being executed. Make sure you are using a version of Node.js that supports the --inspect-brk flag. This is required to use the --debug flag in WebdriverIO. Try using the browser.debug() method instead of debugger. This method will pause the automation and open a browser console, allowing you to inspect the state of the browser and your code. I hope this helps! Let me know if you have any other questions
Hi Raghav, First of all, the session is great. Thank you for making things easy. Although I am facing an issue in generating an allure report, it is asking me to set a JAVA HOME path. I am a little confused here about why we need the JAVA HOME path to generate the allure report. Could you please explain a bit on that?
Amruta The Allure report generator requires a Java environment to function correctly. This is because the Allure report is generated using Java code. The JAVA_HOME environment variable specifies the location of the Java Development Kit (JDK) on your system. When you set the JAVA_HOME environment variable, you are telling the Allure report generator where to find the Java runtime environment. If you do not set the JAVA_HOME environment variable, the Allure report generator will not be able to find the Java runtime environment and will not be able to generate the Allure report. Here are some instructions on how to set the JAVA_HOME environment variable: 1. **Determine the location of the JDK on your system.** This information can typically be found in the JDK installation documentation. 2. **Set the JAVA_HOME environment variable.** For Windows, you can set the JAVA_HOME environment variable using the System Properties window. For macOS and Linux, you can set the JAVA_HOME environment variable using the export command in your terminal. 3. **Verify that the JAVA_HOME environment variable is set correctly.** You can verify that the JAVA_HOME environment variable is set correctly by opening a terminal window and typing the following command: ``` echo $JAVA_HOME ``` If the command returns the location of the JDK, then the JAVA_HOME environment variable is set correctly. Once you have set the JAVA_HOME environment variable, you should be able to generate the Allure report without any problems.
Tharini The `browser` object is not defined in the JavaScript file because it is a WebdriverIO object. WebdriverIO objects are only available in the test runner. To access the `browser` object in your JavaScript file, you can use the `browser` global variable. The `browser` global variable is created by WebdriverIO when the test runner is started. For example, if you have the following JavaScript file: ```js console.log(browser.getTitle()); ``` You would get the following error when you try to execute the file: ``` ReferenceError: browser is not defined ``` To fix the error, you would need to change the JavaScript file to use the `browser` global variable: ```js console.log(global.browser.getTitle()); ``` This would print the title of the current page to the console. Alternatively, you can require the `webdriverio` module in your JavaScript file and then use the `browser` object from the module: ```js const webdriverio = require('webdriverio'); const browser = webdriverio.browser; console.log(browser.getTitle()); ``` This would also print the title of the current page to the console. I hope this helps
Hi Gaurav The error message "Request failed with status 400 due to element not interactable" in Cypress typically indicates that the element you are trying to interact with (in this case, the Google search button) is not in a state where it can receive user interactions such as clicking. Here are a few potential reasons for this error and some troubleshooting steps you can try: Timing issue: Ensure that you are allowing enough time for the page and the element to load completely before interacting with it. You can use Cypress commands like cy.wait(), cy.get().should(), or cy.contains().should() with appropriate assertions to ensure the element is visible and ready to interact with. Element visibility: Verify that the element you are trying to click is actually visible on the page. Elements that are hidden, covered by other elements, or outside the viewport cannot be interacted with directly. You can use Cypress commands like cy.get().should('be.visible') or cy.get().scrollIntoView() to ensure the element is visible before attempting to click it. Element availability: Check if there are any conditions or actions that need to be fulfilled before the element becomes interactable. For example, if there is an AJAX request or some dynamic content loading, you may need to wait for the specific condition to be met using Cypress commands like cy.wait(), cy.intercept(), or cy.contains().should(). Frame/ context: If the element is inside an or frame, make sure you switch to the correct context before interacting with it using the cy.frame() command. Test environment or browser limitations: It's possible that there are specific limitations or restrictions in your test environment or browser that are preventing the element from being interactable. Try running the test in a different browser or updating Cypress to the latest version to see if the issue persists. By reviewing and addressing these potential causes, you should be able to resolve the "element not interactable" error in Cypress.
I have facing issue creating allure report, it gives error that it cannot be loaded because running scripts is disabled on this system.... please help me what should I have to do...!!!!!
Hi Wajeeha The error message "running scripts is disabled on this system" usually indicates that your system's execution policy restricts running PowerShell scripts. To resolve this issue and generate Allure reports in WebDriverIO, you can try the following steps: 1. Open PowerShell as an administrator: Right-click on the PowerShell icon and select "Run as administrator" to open an elevated PowerShell session. 2. Check the current execution policy: In the elevated PowerShell session, run the following command to check the current execution policy: Get-ExecutionPolicy It will return the current execution policy for your system. 3. Change the execution policy: If the current execution policy is set to "Restricted" or "AllSigned," you need to change it to "RemoteSigned" or "Unrestricted" to allow running scripts. Run the following command to change the execution policy: Set-ExecutionPolicy RemoteSigned Note: Setting the execution policy to "RemoteSigned" allows running local scripts, while "Unrestricted" allows running all scripts without any restrictions. Choose the appropriate level of security based on your requirements. 4. Confirm the changes: After changing the execution policy, run the following command to confirm the updated policy: Get-ExecutionPolicy It should display the new execution policy you just set. 5. Generate the Allure report: Try generating the Allure report again using WebDriverIO. The error related to running scripts should no longer occur. Please note that changing the execution policy may have security implications, so it's essential to understand the potential risks and follow security best practices. It's recommended to consult with your system administrator or IT department before making any changes to the execution policy on a corporate system
The error message "npm not being able to find a file" when you type `npm init wdio` in your terminal indicates that there might be an issue with your Node.js environment or the WebdriverIO CLI installation. Here are some steps you can try to troubleshoot and resolve the error: **1. Verify Node.js and npm installations:** * Ensure you have Node.js and npm installed and accessible through the command line. * Check the version of Node.js by running `node -v` in your terminal. * Ensure the version is compatible with WebdriverIO. * Check the npm version by running `npm -v`. * Update npm to the latest version if necessary by running `npm install npm@latest -g`. **2. Reinstall WebdriverIO CLI:** * Try reinstalling the WebdriverIO CLI globally using the following command: ```bash npm install -g @wdio/cli ``` * If the installation fails, try installing it locally within your project directory: ```bash npm install @wdio/cli ``` **3. Check for conflicting packages:** * Make sure you don't have any conflicting packages installed, such as an older version of WebdriverIO CLI or a different testing framework. * Try removing any conflicting packages and try again. **4. Clear npm cache:** * Sometimes, the issue might lie with the npm cache. Try clearing the npm cache by running: ```bash npm cache clean --force ``` **5. Check npm path and permissions:** * Verify that the npm path is correctly configured in your environment variables. * Ensure you have sufficient permissions to write to the npm cache and install packages. **6. Check WebdriverIO version:** * Ensure you are using the correct WebdriverIO version for your project. * Try specifying the WebdriverIO version explicitly while initializing the project using: ```bash npm init wdio@ ``` **7. Seek community support:** * If the above steps don't help, consider seeking assistance from the WebdriverIO community forums or Stack Overflow. * Provide relevant details like your Node.js and npm version, error message, and any other relevant information to get accurate troubleshooting suggestions. **Additional notes:** * Ensure you have all the necessary dependencies for your desired testing framework (e.g., WebDriver, Selenium) installed. * Double-check the command you typed for typos or incorrect syntax. * Consider providing more information about your specific situation and the error message for a more accurate diagnosis and solution. By following these steps and utilizing available resources, you should be able to resolve the "npm not being able to find a file" error and successfully initialize your WebdriverIO project.
Hi Raghav, I'm unable to generate the allure report and getting the below error: allure : The term 'allure' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + allure generate .\allure-results\ + ~~~~~~ + CategoryInfo : ObjectNotFound: (allure:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException I have already installed allure commandline with -g option.
Hi The error message `allure : The term 'allure' is not recognized as the name of a cmdlet, function, script file, or operable program.` means that the `allure` command is not available in your current environment. This can happen for a few reasons: * The `allure` command is not installed on your computer. * The `allure` command is not in your current path. * You are trying to run the `allure` command from a directory that does not have the `allure` command. To resolve the issue, you can try the following: 1. Check if the `allure` command is installed on your computer. You can do this by running the following command: ``` which allure ``` If the `allure` command is not installed, you can install it using your package manager. For example, if you are using Ubuntu, you can install the `allure` command using the following command: ``` sudo npm install -g allure-commandline ``` 2. Check if the `allure` command is in your current path. You can do this by running the following command: ``` echo $PATH ``` The output of this command will show you a list of directories that are in your current path. If the directory where the `allure` command is located is not in your current path, you can add it to your path by editing your `.bashrc` file. 3. Check if you are trying to run the `allure` command from a directory that does not have the `allure` command. You can do this by running the `allure` command from a different directory. If the `allure` command works from a different directory, then the problem is with the directory where you are trying to run the command. Once you have resolved the issue, you should be able to run the `allure` command without any problems. However, if you are still getting the error message, it is possible that you are trying to run the `allure` command from a directory that does not have the `npm` command. To check if the `npm` command is installed, you can run the following command: ``` which npm ``` If the `npm` command is not installed, you can install it using your package manager. For example, if you are using Ubuntu, you can install the `npm` command using the following command: ``` sudo apt install npm ``` Once you have installed the `npm` command, you should be able to install the `allure` command without any problems. If you have installed the `allure` command and it is still not in your path, you can add it to your path by editing your `.bashrc` file. To do this, open your `.bashrc` file in a text editor and add the following line to the end of the file: ``` export PATH=$PATH:/path/to/allure/commandline ``` Once you have saved the `.bashrc` file, you need to reload your shell. You can do this by running the following command: ``` source ~/.bashrc ``` Once you have reloaded your shell, you should be able to run the `allure` command without any problems.
Hi, I am trying to automate a old application of mine.. which has windows authentication and .aspx pages. I am able to bypass windows authentication but when I am trying to redirect to the home.aspx page. It is not loading. Can you help me with this?
Mahesh If you're facing issues with automating a web application that uses Windows authentication and .aspx pages, and you're able to bypass Windows authentication but encounter problems when redirecting to the `home.aspx` page, there could be several reasons for this behavior. Here are some troubleshooting steps you can follow: 1. **Ensure Correct URL:** Double-check that you're using the correct URL to navigate to the `home.aspx` page. Ensure that the URL is correctly formed and points to the page you intend to access. 2. **Wait for Page Load:** .aspx pages can sometimes have complex rendering, which may take a moment to fully load. Use WebdriverIO's wait methods (e.g., `waitForVisible`, `waitForExist`, or explicit waits) to ensure that the page elements you need are present and visible before interacting with them. 3. **Check for Authentication Cookies:** After bypassing Windows authentication, make sure that any authentication cookies or session data required for accessing protected pages like `home.aspx` are properly set and maintained. 4. **Inspect the Page:** Use browser developer tools to inspect the `home.aspx` page and its elements. Verify that the elements you are trying to interact with are correctly identified using selectors (e.g., CSS selectors or XPath). 5. **Handle AJAX Requests:** If the `home.aspx` page makes AJAX requests to load content dynamically, you may need to handle these requests and ensure that they are completed before interacting with the page. WebdriverIO provides methods for waiting for AJAX requests to complete. 6. **Debugging:** Add logging statements to your automation script to trace the execution flow. This can help identify where the script might be encountering issues. 7. **Check for JavaScript Errors:** Errors in JavaScript code on the page can prevent it from loading or functioning correctly. Check the browser console for any JavaScript errors. 8. **Use Explicit Waits:** Consider using explicit waits with expected conditions to wait for specific elements or events that indicate the `home.aspx` page has fully loaded. Here's an example of using explicit wait with WebdriverIO: ```javascript const { browser, $, ExpectedConditions } = require('webdriverio'); // Navigate to the URL browser.url('example.com/home.aspx'); // Wait for an element to be present before interacting with it const element = $('#someElementId'); browser.waitUntil( () => element.isExisting(), { timeout: 5000, // Adjust the timeout as needed timeoutMsg: 'Element not found after 5 seconds', } ); // Perform actions on the page element.click(); ``` By following these steps and considering the specific behavior of your application, you should be able to troubleshoot the issue and successfully automate the navigation to the `home.aspx` page. If you encounter specific error messages or issues, please provide more details, and I can offer more targeted assistance.
HI sir i have downloaded zip file from git and try to run in my local so now i getting error like ERROR @wdio/runner: Error: Failed to create session. [0-0] session not created: This version of ChromeDriver only supports Chrome version 108 [0-0] Current browser version is 120.0.6099.71 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe so i need to change directly in package.js file or need to try with another way?
Rishabh Here are the steps to resolve the "Failed to create session" error due to ChromeDriver version incompatibility: 1. Check Chrome Version: - Verify: Open Chrome and go to `chrome://settings/help` to confirm your exact Chrome version (120.0.6099.71 in this case). 2. Download Compatible ChromeDriver: - Visit Website: Go to [chromedriver.chromium.org/downloads](chromedriver.chromium.org/downloads). - Match Version: Download the ChromeDriver version that matches your Chrome version (120.0.6099.71). - Extract: Unzip the downloaded file. 3. Update Project Configuration: - Specify Path: - package.json: If using WebDriverIO, locate the `webdriverio` configuration in `package.json` and update the `chromedriver` path to point to the extracted ChromeDriver executable. - Code: If configuring ChromeDriver in your code, update the path accordingly. 4. Additional Considerations: - Global Installation: If you prefer a global installation, run `npm install -g chromedriver` to install the compatible version globally. - Virtual Environment: If using a virtual environment, make sure to install ChromeDriver within that environment. - Project-Specific Installation: Consider adding ChromeDriver as a project dependency for easier management. 5. Rerun Tests: - Restart: If necessary, restart your terminal or IDE for changes to take effect. - Execute Tests: Run your tests again. They should now function correctly with the compatible ChromeDriver. Key Points: - Always match ChromeDriver and Chrome versions for smooth operation. - Regularly check for updates to both Chrome and ChromeDriver to maintain compatibility. - Consider using tools like `webdriver-manager` to automate ChromeDriver management.
Hi Sir I am getting error like Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'F:\Evolutyz\WebdriverIO\WebdriverIO_project_1 ode_modules\https-proxy-agent\' imported from F:\Evolutyz\WebdriverIO\WebdriverIO_project_1 ode_modules\geckodriver\dist\install.js How to slove it
Rishabh For the issue "Cannot find package 'https-proxy-agent'" error in your WebdriverIO project. Here are the steps to troubleshoot and fix it: 1. Install the Missing Package: - Open your terminal or command prompt and navigate to your project's root directory. - Run the following command to install the `https-proxy-agent` package: ```bash npm install https-proxy-agent ``` 2. Clear Cache and Reinstall Dependencies: - If the package is already installed, clear the npm cache and reinstall dependencies: ```bash npm cache clean --force npm install ``` 3. Check for Global Installation: - If you've globally installed `https-proxy-agent`, remove the global installation: ```bash npm uninstall -g https-proxy-agent ``` - Then, reinstall it locally within your project using `npm install https-proxy-agent`. 4. Address Version Conflicts: - Review your `package.json` file for any version conflicts between `https-proxy-agent` and other packages. - Update or resolve conflicts as needed. 5. Verify Import Paths: - Ensure the import path in `geckodriver/dist/install.js` is correct, pointing to the local `https-proxy-agent` module. - If necessary, adjust the path based on your project structure. 6. Rebuild Node Modules: - In rare cases, rebuilding the `node_modules` folder might help: ```bash rimraf node_modules npm install ``` Additional Tips: - Review Logs: Examine any additional error messages or logs for clues. - Check Permissions: Ensure your user has permissions to install packages in the project directory. - Seek Community Help: If the issue persists, consult WebdriverIO forums or communities for further guidance.
Do we have a tutorial of how to used data in json and call from json instead of hardcoding the value ? This session is clear absolutely understandable hats off to you for that sir.
Hi raghav,I followed the steps but the test folder is not created for me and while running I am getting error as no specs found to run,exiting with failure
Hi Sindhu, WebdriverIO expects to find test specs in a specific folder structure by default. The folder structure should look like this: . ├── wdio.conf.js └── test └── myTest.spec.js If you have not created a test folder with any test specs, you will get the error "no specs found to run". To resolve this issue, create a test folder in the root of your project and add your test specs in that folder. For example, create a myTest.spec.js file in the test folder: . ├── wdio.conf.js └── test └── myTest.spec.js Then, run the test again using the following command: npx wdio wdio.conf.js This should find your test specs and run them successfully. If you are still having issues, make sure that your wdio.conf.js file is properly configured to point to the correct directory for your test specs.
For some reason whenever i went through the wdio set up it didnt have all of the same options as listed here and once it was set up i didnt have a test file created
Danish To install ChromeDriver and GeckoDriver if no option is displayed on setup, you can follow these steps: 1. Download the latest versions of ChromeDriver and GeckoDriver from the SeleniumHQ website: www.seleniumhq.org/download/. 2. Unzip the downloaded files. 3. Copy the `chromedriver` or `geckodriver` executable file to the directory where your WebDriverIO tests are located. 4. Update the `desiredCapabilities` object in your WebDriverIO tests to specify the path to the appropriate driver. For example: ``` const capabilities = { browserName: 'chrome', chromeOptions: { args: ['--headless'] } }; ``` 5. Run your WebDriverIO tests. If you are still not able to run the login test, you can try the following things: * Make sure that you are using the correct version of ChromeDriver and GeckoDriver for the version of Chrome and Firefox that you are using. * Make sure that the `chromedriver` or `geckodriver` executable file is executable. * Make sure that the `desiredCapabilities` object in your WebDriverIO tests is correct. * Check the logs for any errors. I hope this helps
I'm not seeing Chromedriver and Geckodriver options in the 'Add a service to your test setup' list. However I did manually install and add these services in wdio.conf.js. On running npm run wdio, I'm getting "Failed to initilialise launcher service unknown: Error: Couldn't find plugin "chromedriver" service, neither as wdio scoped package "@wdio/chromedriver-service" nor as community package "wdio-chromedriver-service". Please make sure you have it installed!". Please help!
Shridhar It looks like you're encountering an issue with the WebdriverIO setup. The error message suggests that the `chromedriver` service plugin is not being recognized. Here's what you can do to resolve this: 1. Ensure Correct Installation: Make sure that you have installed `chromedriver` and `geckodriver` correctly. They should be added as devDependencies in your `package.json` file. You can install them using the following commands: ```bash npm install chromedriver --save-dev npm install geckodriver --save-dev ``` 2. Update `wdio.conf.js`: Verify that your `wdio.conf.js` file includes `chromedriver` and `geckodriver` in the services array. It should look something like this: ```javascript exports.config = { // ... services: ['chromedriver', 'geckodriver'], // ... }; ``` 3. Check Compatibility: Ensure that the versions of `chromedriver` and `geckodriver` are compatible with the browser versions you are testing against. 4. WebdriverIO Version: If you are using WebdriverIO v8.14 or above, it handles the browser driver setup automatically⁶. You just need to specify the browser you want to test, and WebdriverIO will take care of the rest. 5. Check for Scoped Package: If you are using a scoped package (e.g., `@wdio/chromedriver-service`), ensure that it is installed and listed in your `package.json`. 6. Review Error Message: The error message you provided suggests that the service is not found. If you have recently upgraded WebdriverIO, make sure that any old references to services that are no longer used are removed from your configuration. 7. Community Support: If the issue persists, consider seeking help from the WebdriverIO community. You can find support and discussions related to similar issues which might provide a solution¹¹. Remember to restart your WebdriverIO service after making changes to the configuration. If you continue to face issues, please share your `wdio.conf.js` file and `package.json` dependencies for a more detailed analysis. This will help in pinpointing the exact cause of the problem.
Hi Raghav, I have setup the sample project and performed the actions to generate allure reports. I see the allure results folder created but when I run allure open the server is running but I don’t see any report in browser. What could be the issue here?
Hi Nidhi, If you are using WebdriverIO to generate Allure reports and the reports are not showing up in the browser, there are a few things you can check: Make sure that you have the Allure command line tool installed: You need to have the Allure command line tool installed on your system in order to generate and view reports. You can download the Allure command line tool from the official website. Check that the path to the Allure results folder is correct: When you run "allure generate", you need to specify the path to the Allure results folder. Make sure that you are specifying the correct path and that the Allure results files are in the correct location. Check that the Allure server is running: When you run "allure open", it starts a local server that serves the Allure report. Make sure that the server is running and that you are accessing the correct URL. The server should display a message in the terminal indicating that it is running. Check that your browser is compatible with Allure: Allure supports Google Chrome, Mozilla Firefox, and Microsoft Edge browsers. Make sure that you are using a compatible browser to view the Allure report. Try opening the report manually: If the Allure server is running but you still can't see the report in the browser, try opening the report manually by navigating to the path where the report is stored in your file system. The path should be something like "allure-report/index.html". If none of these solutions work, you can try regenerating the Allure report and see if that solves the issue. If you are still having trouble, you may need to seek additional support from the WebdriverIO or Allure communities or consult the WebdriverIO and Allure documentation
Hi Raghav , is there any video where you explain async and await statements? sb told me that await command waits until previous step is finished so then following statements can continue in a sequential order (not in parallel), is this correct or not ?
Hi Yes, that is correct. The `await` command in JavaScript pauses the execution of the current function until the asynchronous function it is waiting for has completed. This means that the following statements will not be executed until the previous step is finished. For example, if you have the following code: ``` async function myFunction() { let result = await someAsyncFunction(); console.log(result); } ``` The `myFunction()` function will not log the result of the `someAsyncFunction()` function until the `someAsyncFunction()` function has completed. This means that the `console.log()` statement will be executed sequentially, not in parallel. The `await` command is a powerful tool that can be used to control the flow of asynchronous code. It can help to make your code more readable and easier to debug. Here are some additional things to keep in mind about the `await` command: * The `await` command can only be used inside an async function. * The `await` command can only be used before a promise. * The `await` command will throw an error if the promise is rejected
Hi Raghav, I practiced with this video. It opened Chrome, but it couldn't locate the search bar and setvalue. It reported an error: [0-0] error: 'no such element', [0-0] message: 'no such element: Unable to locate element: {"method":"css selector","selector":"[name="q"]"} ' In my browser, the search bar is not input but textarea, and I'm not sure if that's the reason
You are correct. The error message you are receiving is because the search bar is a element, and WebDriverIO is trying to find an element. The solution is to use the `addValue()` method instead of the `setValue()` method. The `addValue()` method is specifically designed to work with elements. Here is the modified code: ```javascript describe('Demo Test', function () { it('My First Test', async () => { browser.url('google.com') // Instead of using setValue, use addValue to interact with the textarea await $('[name="q"]').addValue('WebdriverIO') browser.pause(2000) }) }) ``` This code should now be able to locate the search bar and set the value to "WebdriverIO". I hope this helps
Hi raghav, I followed all the steps u mention when I run the command allure open the browser gets launched and opens allure report page but it doesn't have data it's showing allure report unknown and 0 test cases..can you help me on this
Hi Durga, To resolve the issue of the allure report having no data, you can try the following steps: Check that the Allure adapter is installed correctly and is included in the wdio.conf.js file. Ensure that the allure commands are properly integrated in the test code. Make sure that the allure-results folder has the generated data If there is still no data in the report, try regenerating the report with the allure generate command If the issue still persists, check the version compatibility between WebdriverIO, the allure adapter, and the allure CLI. Upgrade to the latest version if necessary
Hi Raghav , Great session as it very understanding but I am facing some issue while doing setup , whenever i run the command "npm run wdio" it is giving me an error as "npm ERR! code ENOENT npm ERR! syscall spawn C:\Program Files\Java\jdk1.8.0_261\bin npm ERR! path C:\Program Files\WebdriverIO npm ERR! errno -4058 npm ERR! enoent spawn C:\Program Files\Java\jdk1.8.0_261\bin ENOENT npm ERR! enoent This is related to npm not being able to find a file." Please help me in this
Shubham Here are the potential causes and steps to resolve it: 1. Missing or Incorrect Java Path: - Verify Java Installation: Ensure Java is installed at the specified path (`C:\Program Files\Java\jdk1.8.0_261\bin`). - Check Environment Variables: - Open System Properties (or Environment Variables) and locate the `JAVA_HOME` variable. - Make sure it points to the correct Java installation directory. - If it's missing, create it and set the value. - Also, ensure `%JAVA_HOME%\bin` is added to your PATH variable. 2. Permissions Issue: - Run as Administrator: Try running the command prompt or terminal as an administrator. - Check File Permissions: Ensure your user account has read and execute permissions for the Java directory and files. 3. Conflicting npm Scripts: - Review `package.json`: Examine your `package.json` file to ensure the `wdio` script is defined correctly and doesn't have conflicts with other scripts. 4. npm Configuration: - Check npm Config: Run `npm config list` to review your npm configuration. - Adjust `prefix`: If the `prefix` setting is incorrect, it might interfere with finding files. 5. Reinstall Dependencies: - Clear Cache and Reinstall: Clear npm's cache using `npm cache clean --force` and reinstall dependencies with `npm install`. 6. npm and Node.js Version: - Upgrade npm: Consider upgrading npm to the latest version using `npm install -g npm`. - Check Node.js Compatibility: Verify that your Node.js version is compatible with your WebdriverIO and other project dependencies. Additional Tips: - Inspect Error Logs: Check for more detailed error messages in npm or WebdriverIO logs. - Try Different Terminal: Experiment with different terminals or command prompts.
Nishan Let's break down the steps to automate an installed Electron application (.exe) using WebdriverIO: Step 1: Install WebdriverIO and required dependencies * Install WebdriverIO using npm by running the command `npm install webdriverio` * Install the chromedriver package using `npm install chromedriver` (since Electron apps use Chromium) Step 2: Set up the Electron application * Make sure the Electron application is installed and running on your system * Identify the executable path of the Electron application (e.g., `C:\Path\To\App.exe`) Step 3: Configure WebdriverIO to interact with the Electron application * Create a new WebdriverIO configuration file (e.g., `wdio.conf.js`) with the following settings: ```javascript export const config = { //... capabilities: [{ browserName: 'chrome', chromeOptions: { binary: 'C:\\Path\\To\\App.exe', // path to the Electron app executable args: ['--disable-dev-shm-usage', '--no-sandbox'] // optional args to stabilize the session } }], //... }; ``` In this configuration, we're telling WebdriverIO to use the Chrome browser (since Electron apps are built on Chromium) and specifying the path to the Electron application executable. Step 4: Write a test script to interact with the Electron application * Create a new test file (e.g., `app.test.js`) and import the WebdriverIO client: ```javascript const { client } = require('webdriverio'); describe('Electron App Automation', () => { it('should launch the app and perform some action', async () => { const browser = await client.init(); // Perform some action on the app, e.g., click a button await browser.click('#some-button'); // Verify the expected outcome await browser.waitUntil(async () => { const text = await browser.getText('#some-element'); return text === 'Expected text'; }); await browser.deleteSession(); }); }); ``` In this example, we're launching the Electron application using WebdriverIO, performing some action (e.g., clicking a button), and verifying the expected outcome. Step 5: Run the test script * Run the test script using the command `npx wdio app.test.js` (assuming your test file is named `app.test.js`) -
Your videos are very informative and useful for the entire testers community. I am having following issue. "Appium exited before timeout.exit code : null." How to fix this error? Can I have the solution? I increased the timeouts also, but still it exists. Nodejs version : 20.3.1 Wdio version : 8.36.1 Appium version : 2.5.4
To fix the "Appium exited before timeout" error in WebdriverIO with Appium, consider the following solutions: 1. Update `wdio.conf.js`: - Add the following properties to your `wdio.conf.js` file: ```javascript // Inside the config object capabilities: [{ // Other capabilities... 'appium:noReset': true, // Prevent app reset between sessions 'appium:newCommandTimeout': 60000, // Set a longer command timeout (adjust as needed) }], ``` - These settings ensure that Appium doesn't reset the app and allows sufficient time for commands. 2. Check Appium Server Logs: - Run Appium server separately (outside WebdriverIO) and observe its logs. - Look for any specific errors or warnings related to timeouts or unexpected exits. - Adjust your configuration based on the logs. 3. Verify Dependencies: - Ensure that your Node.js, WebdriverIO, and Appium versions are compatible. - Update any outdated dependencies. Remember to apply these changes and retry your tests.
@@RaghavPal Thanx brother. I will apply your solutions. If anything else, I contact u. Can I have the compatibility matrix list for wdio,nodejs and appium? It will be more helpful for me.
Hi Raghav sir, thanks for the awesome info, have one doubt, do we really need to name the test files as abc.spec.js instead of abc.js because I see the suggestions are more elaborate with first approach like you did.
Hi Anil In WebdriverIO, the convention is to name the test files with a `.spec.js` extension. While it is not strictly required to follow this naming convention, it is a best practice that helps to easily identify and differentiate test files from other JavaScript files in your project. The `.spec.js` extension is commonly used to indicate that the file contains test specifications or test cases. It helps in organizing and maintaining the test files within the project structure. Additionally, many testing frameworks and tools, including WebdriverIO, automatically search for files with a `.spec.js` extension when running tests. However, if you prefer a different naming convention or want to use a different file extension for your test files, you can customize it according to your project's needs. Just make sure to configure your testing framework or runner to look for the appropriate file extension when executing the tests. Remember that consistency and clarity in naming conventions can make your test suite more maintainable and easier to understand for you and your team.
सर मेने आपके चैनल के बहुत सारे वीडियो देखें है आप बहुत अच्छे से समझाते हो । मुझे एक प्रश्न का जवाब देदो तो आपकी बड़ी कृपा होगी मेने एक गूगल शीट में फार्मूला लगाकर income tax सम्बन्धी यूटिलिटी/सॉफ्टवेयर बनाया है जिसमे नॉर्मली डाटा फीड करने पर पूरा हिसाब किताब कैलकुलेट होकर आता है । अब मैं चाहता हु की यही काम एक वेबसाइट पर करू जिसमे डाटा फीड करू ओर डाटा कैलकुलेट होकर यूजर को मिल जाए । कृपया सर इस सम्बंध में मुझे मार्गदर्शन प्रदान करें या आपके अनुभव के आधार पर आईडिया देवे आपकी बड़ी कृपा होगी ।
Jyōthīßh There are a few possible reasons why you are not getting drivers in your WebdriverIO services: * You have not installed the required driver packages. * You have not configured your WebdriverIO configuration file correctly. * There is a problem with the driver installation. To troubleshoot the issue, you can try the following: 1. Make sure that you have installed the required driver packages. You can find the list of required driver packages in the WebdriverIO documentation. 2. Check your WebdriverIO configuration file to make sure that you have configured your services correctly. You can find information on how to configure your services in the WebdriverIO documentation. 3. Try restarting your computer. 4. Try running your tests in a different terminal or command prompt. 5. Search for help online. There are many resources available online that can help you to troubleshoot WebdriverIO errors. If you are still having trouble, please provide me with more information about your setup, such as your WebdriverIO version, operating system version, and the specific error message that you are getting. I will try my best to help you resolve the issue. Here are some additional tips for getting drivers in your WebdriverIO services: * Use a service manager such as `wdio-local-runner` or `wdio-docker-runner` to manage your WebdriverIO services. These services will automatically download and install the required drivers for you. * Use a cloud-based testing service such as Sauce Labs or BrowserStack. These services provide you with access to a wide range of browsers and operating systems, and they will automatically manage the drivers for you. * Use a headless browser such as Puppeteer or Chrome Headless. These browsers do not require a graphical user interface, so they do not require any drivers. I hope this helps
Anyone who had error while running this command due to permission denied on mac npm install -g allure-commandline --save-dev Error: EACCES: permission denied, access '/usr/local/lib/node_modules' Solution: 1) first know your whoami by running command in terminal whoami user_name 2) then, change ownership of these 3 directories to the above user_name (your user) sudo chown -R user_name /usr/local/lib/node_modules/ sudo chown -R user_name /usr/local/bin/ sudo chown -R user_name /usr/local/share/ and the EACCES error will go away.
Hi, thank you for spreading the knowledge with your clear and easy to follow videos! I do have a problem I hope you can help me with. All has gone well until I am trying to generate the report. I then get the following error and even with uninstalling, and re installing multiple times (globally or locally) I get the same error. Any help would be truly appreciated. Thank you in advance, Harjit PS C:\WebDriverIO\WebDriverIO_Project1> allure generate .\allure-results\ node:internal/child_process:421 throw new ErrnoException(err, 'spawn'); ^ Error: spawn EINVAL at ChildProcess.spawn (node:internal/child_process:421:11) at Object.spawn (node:child_process:761:9) at module.exports (C:\Users\Harji\AppData\Roaming pm ode_modules\allure-commandline\index.js:7:37) at Object. (C:\Users\Harji\AppData\Roaming pm ode_modules\allure-commandline\bin\allure:5:1) at Module._compile (node:internal/modules/cjs/loader:1368:14) at Module._extensions..js (node:internal/modules/cjs/loader:1426:10) at Module.load (node:internal/modules/cjs/loader:1205:32) at Module._load (node:internal/modules/cjs/loader:1021:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12) at node:internal/main/run_main_module:28:49 { errno: -4071, code: 'EINVAL', syscall: 'spawn' } Node.js v21.7.3
It seems you're encountering an error while trying to generate an Allure report using WebDriverIO. The error message indicates an issue related to spawning a process. Let's troubleshoot this step by step: 1. Check Node.js Version Compatibility: - The error message shows that you're using Node.js version 21.7.3. - Ensure that your WebDriverIO project is compatible with this Node.js version. Some packages or tools may not work correctly with the latest Node.js versions. - Consider downgrading to a stable LTS (Long-Term Support) version (e.g., Node.js 14.x or 16.x). 2. Reinstall Allure Command Line: - Since you've already tried uninstalling and reinstalling, let's ensure you have the correct version of Allure Command Line. - Run the following command to install Allure globally (if not already done): ``` npm install -g allure-commandline ``` 3. Check Allure Configuration: - Verify that your `wdio.conf.js` configuration includes the Allure reporter and specifies the output directory: ```javascript // wdio.conf.js exports.config = { // Other configuration options... reporters: [['allure', { outputDir: './allure-results', disableWebdriverStepsReporting: true, disableWebdriverScreenshotsReporting: false, }]], // ... }; ``` - Make sure the `outputDir` points to a valid directory where Allure results will be generated. 4. Run Allure Generate Command: - Navigate to your project directory where the `allure-results` folder exists. - Run the following command to generate the Allure report: ``` allure generate --clean ``` - This command will process the results in the `allure-results` folder and create the report files. 5. Open the Allure Report: - After generating the report, run the following command to open it in your default web browser: ``` allure open ``` 6. Additional Considerations: - If you're using any custom hooks or scripts related to Allure, review them for any potential issues. - Check if there are any conflicting global installations of Allure or other packages. Remember to adjust the Node.js version and ensure that your project dependencies are correctly set up
7 місяців тому
@@RaghavPal Hello again! Thank you for your advice and help and sincere apologies for not responding sooner. I ran through the tutorial again from scratch using the same versions as per your recording but found I was still having the same issue. After a bit of digging I found the allure generate command would only work if it is run on the command prompt and in the location "C:\WebDriverIO\WDIO_Project1 ode_modules\allure-commandline\dist\bin" (but not VSCode terminal). I am guessing that must be because this is where the allure.bat file is. Can you advise what I am missing to make it work within VSCode? In order to generate the report I would have to provide the full path to the results folder using the command "allure generate C:\WebdriverIO\WDIO_Project1\allure-results\" which would then create the report folder in "C:\WebdriverIO\WDIO_Project1 ode_modules\allure-commandline\dist\bin\allure-report" I was then able to run "allure open" to see the report :) If you have the time, please could you advise how to make this run within VSCode terminal window. Thank you again and kind regards, Harjit
It's great that you were able to generate the Allure report using the command prompt! Let's address how to make it work within the Visual Studio Code (VSCode) terminal. The issue you're facing might be related to the environment variables or the working directory. Here are some steps to troubleshoot and ensure that Allure commands work seamlessly within the VSCode terminal: 1. Check Allure Installation: - First, make sure you have Allure installed globally on your system. You can install it using npm: ``` npm install -g allure-commandline ``` - Verify that you can run `allure --version` successfully in the VSCode terminal. 2. Working Directory: - When running commands in VSCode, the working directory matters. Ensure that you are in the correct project directory (e.g., `C:\WebdriverIO\WDIO_Project1`) when executing Allure commands. - You can change the working directory in the VSCode terminal using the `cd` command: ``` cd C:\WebdriverIO\WDIO_Project1 ``` 3. Path to Allure Executable: - If Allure is installed globally, you should be able to run it from any directory. However, if you want to use a local installation (within your project), you can specify the full path to the Allure executable: ``` node_modules\.bin\allure generate allure-results --clean -o allure-report ``` Replace `node_modules\.bin\allure` with the correct path relative to your project. 4. Environment Variables: - Check if the path to the Allure executable is included in your system's `PATH` environment variable. If not, add it manually. - Restart VSCode after modifying environment variables to ensure they take effect. 5. VSCode Terminal Settings: - Sometimes, VSCode terminal settings can cause issues. Make sure you haven't accidentally set any custom configurations. - You can also try opening a new terminal in VSCode (hit the "+" button in the terminal panel) to see if that resolves the issue. 6. Permissions: - Ensure that you have the necessary permissions to execute commands in the VSCode terminal. - If you encounter permission errors, try running VSCode as an administrator. Remember to follow these steps, and you should be able to run Allure commands directly within the VSCode terminal
i got new error "ERROR webdriver: RequestError: getaddrinfo ENOTFOUND localhost & ERROR @wdio/runner: Error: Failed to create session." how i can resolve that
Hi Shubham The error message "ERROR webdriver: RequestError: getaddrinfo ENOTFOUND localhost" indicates that the WebDriver is unable to resolve the hostname "localhost" to an IP address. This typically happens when the WebDriver is unable to connect to the specified URL or when the URL is incorrect. Here are a few steps you can take to resolve this issue: 1. Verify the URL: Double-check the URL you are providing to the WebDriver. Make sure it is correct and properly formatted. Ensure that "localhost" is spelled correctly and that there are no typos in the URL 2. Check the WebDriver configuration: Review your WebDriver configuration and ensure that the hostname and port settings are correctly specified. Ensure that the WebDriver is configured to connect to the correct URL and port where your application is running 3. Check network connectivity: Ensure that your machine has network connectivity and is able to resolve hostnames. Test network connectivity by trying to access the same URL manually in a web browser or using tools like cURL or Postman. If you are unable to access the URL, there may be a network configuration issue that needs to be resolved 4. Check application availability: Ensure that your application is running and accessible at the specified URL. Make sure the application is started and listening on the expected port. If the application is not running or is not accessible, the WebDriver won't be able to establish a connection 5. Check proxy settings: If you are using a proxy server to connect to the internet, make sure your WebDriver is configured to use the correct proxy settings. Improper proxy configuration can lead to connection issues 6. Firewall and security settings: Check if there are any firewall or security settings that may be blocking the connection to the specified URL. Temporarily disabling firewalls or adjusting security settings can help diagnose if they are causing the issue By following these steps, you should be able to troubleshoot and resolve the "RequestError: getaddrinfo ENOTFOUND localhost" error
@@RaghavPal hello sir thank you very much for your valuable replay this really help me, this error is resolved. but new error was occured is "TypeError in "My Login application.should login with valid credentials" TypeError [ERR_INVALID_URL]: Invalid URL" this is the error
Shubham The error message "TypeError [ERR_INVALID_URL]: Invalid URL" indicates that the URL that you are trying to use is not valid. This could be due to a number of reasons, such as a typo in the URL, or the URL being for a resource that does not exist To troubleshoot this error, you can try the following: 1. Check the URL that you are using to make sure that it is correct 2. Try using a different URL to access the resource 3. Make sure that the resource that you are trying to access is actually available If you are still getting the error after trying these steps, you can contact WebdriverIO support for help. Here are some possible reasons why you might be getting this error: * You are trying to use a URL that is not valid * The resource that you are trying to access is not available * There is a problem with your network connection * There is a problem with WebdriverIO If you are sure that the URL is valid and the resource is available, you can try the following to troubleshoot the problem: * Check your network connection. * Restart your computer. * Update WebdriverIO. * Contact WebdriverIO support for help
Hello Raghav, when I type npm init wdio I get an error, I hace ndm and node installed, The issue is npm ERR! code ENOENT ' + 'npm ERR! syscall lstat ' + 'npm ERR! path C:\\Users\\user\\AppData\\Roaming\ pm ' + 'npm ERR! errno -4058 ' + "npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\\Users\\user\\AppData\\Roaming\ pm' " + 'npm ERR! enoent This is related to npm not being able to find a file. ' + 'npm ERR! enoent ' +
Maria For "ENOENT" error you're encountering when running `npm init wdio`. Here are the steps to troubleshoot: 1. Address Missing Directory: - Create Missing Directory: Manually create the missing directory using your command prompt: ```bash mkdir C:\Users\user\AppData\Roaming pm ``` 2. Reinstall Node.js and npm: - Consider Reinstallation: If the directory issue persists, a clean reinstallation of Node.js might be necessary. This often rectifies corrupted installation files or incorrect configurations. 3. Check Environment Variables: - Verify PATH: Ensure the `npm` path is included in your PATH environment variable. You can check and adjust this through System Properties > Environment Variables. 4. Run as Administrator: - Elevated Privileges: Attempt running the command prompt or terminal as an administrator to overcome potential permission restrictions. 5. Clear Cache: - Refresh npm Cache: Clear the npm cache using `npm cache clean --force`. 6. Resolve Conflicts: - Manage Multiple Versions: If you have multiple Node.js or npm versions, ensure you're using the intended ones and avoid conflicts.
Best Wdio video tutorial seen so far. Crisp clear and simple. 🙂
Glad it was helpful Santanil
this is the best tutoerial i've seen on this subject, thank you so much, i would have saved a lot of time only if I new about your videos, you're the best!!!
You're very welcome!
hello Ragnav! it is pleasure to watch content with high quality
Great to know this
Super clear, Raghav. Many thanks for this supercool learning video.
So nice of you
Hello Raghav, that was a great learning session, thank you. Awaiting for your next session on POM, assertions, reading data from file and more.
Next session coming soon,
POM
Jenkins
Reports
Cucumber
Hey Raghav, the way you present and teach is amazing. Keep the videos coming. Thnaks
Thank you, I will
Thanks so much for such a kind job, sir! It was so perfect and productive explanation for beginners!
Most welcome Alonzo
Great Work sir! Thanks for sharing the knowledge to others, I am able to understand very easily from your tutorial🙏
So nice of you Ram
Hello Raghav, I liked the way you demonstrated the concept and took in a very simple manner. Thanks for this video..
Glad you liked it!
Great Tutorial, step by step, really good job :)
Thanks a lot
Just a crisp and clear session and all required info, Thank you!
Most welcome
Wow!! Now you created! It's so wonder tool that I really want. Thanks!
Most welcome
Hi, thank you for a learning session. I am curious if it is possible to manipulate web browser and desktop application within one test? If so, it would be highly appreciated to have a tutorial from you. Thank you!
Yes, it is possible to manipulate a web browser and a desktop application within one test using WebdriverIO. You can use the `multiremote` function to create a new instance of WebdriverIO that can control multiple browsers and applications.
Here is an example of how you can use the `multiremote` function to manipulate a web browser and a desktop application within one test:
```
const { multiremote } = require('webdriverio');
(async () => {
const browser = await multiremote({
browsers: ['chrome'],
});
const app = await browser.launchApp('C:\\Program Files\\MyApplication.exe');
// Manipulate the web browser
await browser.goto('www.google.com');
await browser.setValue('#q', 'webdriverio');
await browser.click('button[name="btnK"]');
// Manipulate the desktop application
await app.click('button[name="myButton"]');
await browser.close();
await app.close();
})();
```
This code will first launch a Chrome browser and an application called "MyApplication.exe". The code will then navigate to the Google search page in the browser and enter the search term "webdriverio". The code will then click on the search button. The code will then click on a button called "myButton" in the desktop application. Finally, the code will close the browser and the desktop application.
I hope this helps
@@RaghavPal Thank you, @RaghavPal. I will try to implement it in my test. Appreciate it!
Thank you so much. You helped me for pass test task
Most welcome
Hi is this setup is same for mobile application automation also
Harini
No, the setup differs slightly for web and mobile automation in WebdriverIO:
Web Automation:
Use browser capabilities (browserName: 'chrome' or 'firefox').
Install a web driver service like chromedriver or geckodriver
Mobile Automation:
Use Appium capabilities (e.g., platformName: 'Android', appium:deviceName, appium:app)
Install and configure Appium service (@wdio/appium-service)
Each setup has unique configurations tailored to the platform
-
Thanks for the great session Raghav 👏
Always welcome
If you are unable to install the webdriverio using "npm init wdio" follow these steps
1) Check if your npm is installed globally if not use command
npm install -g npm
2) Use this to clean the cache related problems
npm cache clean --force
3) Set your global variables properly as described in video.
4) Run
npm init -y
5) Run
npm init wdio --legacy-peer-deps
Select less packages/dependencies so that the installation does not fail due to any extra packages that are not crucially required.
Thanks for adding Shubham
How to make project like POM pattern? Have any other pattern in this framework?
POM coming next in this series
Brilliant as always, thank you so much
Most welcome Сергей
Hello Raghav, Can we automate windows based/desktop application with WebdriverIO?
Yes, you can automate Windows-based or desktop applications with WebdriverIO. To do so, you'll need to use Windows Application Driver (WinAppDriver), which is capable of receiving and interpreting WebDriver protocol commands for Windows applications. Additionally, it's recommended to use an Appium server as a proxy for increased flexibility and better interaction with app elements
Here's a brief overview of the steps involved:
1. Install WinAppDriver on your system.
2. Set up an Appium server to act as a bridge between your tests and WinAppDriver.
3. Use Accessibility Insights for inspecting elements within your application.
4. Configure your WebdriverIO project to include the Appium service.
5. Define Appium capabilities in your test scripts to instruct the server on how to interact with your application.
For a detailed guide and step-by-step instructions, you can refer to resources available online that walk you through the process of setting up your first automation test scenario for a Windows app using WebdriverIO.
Remember, you'll need to have Node.js installed as WebdriverIO is a Node.js-based automation framework.
superb sir nice explaining thanks for the content 😇
Most welcome
Hi Raghav, i have setup webdriverio in mac i found the error "Could not execute "run" due to missing configuration, file
".wdio[.js/.ts]" not found!"
Hi Amit,
The error message you're seeing suggests that WebdriverIO is not able to find the configuration file it needs to run your tests. By default, WebdriverIO looks for a configuration file called wdio.conf.js in the root directory of your project.
Here are some steps you can take to resolve this issue:
Check that the configuration file exists in your project directory. If it doesn't exist, you'll need to create one. You can do this manually, or you can use the WebdriverIO CLI to generate a configuration file for you. To generate a configuration file using the CLI, run the following command in your terminal:
npx wdio config -y
This will generate a default configuration file called wdio.conf.js in your project directory.
If the configuration file already exists in your project directory, make sure that it's named correctly (wdio.conf.js) and that it's located in the root directory of your project.
If the configuration file exists and is named correctly, double-check that you're running the wdio command from the root directory of your project. If you're running the command from a subdirectory, WebdriverIO may not be able to find the configuration file.
Once you've made any necessary changes, try running your tests again. If you're still seeing the same error message, you may need to provide more information about your project setup and configuration in order to troubleshoot further
Hai Raghav, I was struck at "Do you want add a service to your test setup?"
I am not getting Chrome driver or edge driver.
Can you pls help me to continue.
Thanks
Tejaswini
Can try installing again globally. Can check this webdriver.io/blog/2023/07/31/driver-management/
Hello Raghav, Great session! I am looking for the complete framework setup Hope you'll cover everything Thank you so much.
Thanks for watching, yes, I uploaded POM video today, others are coming soon
Thank u for your great effort as always. I have an issu, the first test what u wrote in this video has been skipped und cant find out why, i just follow every step u done. Do you maybe have any suggestions? Thank u very much
Hi Hasan, Pls tell me the time stamps, I will check
Hi Sir, I am currently in testing with webdriverio and typescript and cucumber framework, now I am interested in learning SDET as a pack , what do you suggest? Is it good to learn for senior levels ?
Anitha
Becoming a Software Development Engineer in Test (SDET) can be a great career move especially for senior-level professionals. Let's explore what SDET entails and why it might be a good fit for you:
1. What is SDET?
- SDET stands for Software Development Engineer in Test. It's a role that bridges the gap between software development and testing
- SDETs are skilled in both coding and software testing, making them valuable contributors to the software development lifecycle
2. Why SDET?
- Organizations seek SDETs because they can handle both automation and testing
- SDETs have deep knowledge of software engineering, SDLC, and STLC processes
- They're in high demand due to their ability to ensure quality while automating processes
3. When Is SDET Needed?
- Consider SDET when:
- The software system is robust and challenging to manage manually
- Data-driven testing with complex scenarios and large datasets is required
- Continuous monitoring of the entire process is essential
4. SDET vs. Other Roles:
- SDET vs. QA:
- QA focuses on test execution, while SDETs participate in project planning, code review, and automation
- SDET vs. Developer:
- SDETs have knowledge of software architecture but aren't directly involved in development
- They ensure better quality standards and less defective software
- SDET vs. Automation Engineer:
- SDETs and automation engineers are often treated as the same
- SDETs review code, write unit tests, and analyze test coverage
5. Career Path:
- Junior SDET (0-3 years):
- Create automation test scripts, write test cases, and learn new tools.
- Senior SDET (3-7 years):
- Verify acceptance criteria, analyze root causes, review code, and create/update automation scripts
6. Skills Needed:
- Hands-on experience with multiple test automation tools and frameworks
- Proficiency in both white-box and black-box testing
- Understanding of software development principles
In summary, learning SDET can enhance your career, especially if you're interested in both coding and testing. It's a valuable skill set for senior-level professionals like yourself
-
@@RaghavPal thanks for your reply, if you know the any best platform or institute can you suggest me , I feel great to hear from you
ok
Thank you very much for this video.
Most welcome 🙏 Sheryl
Hi Raghav Sir, is there any video on the interview questions for web driver IO
Hi Kalyan
not separate video, but if you follow all the sessions with hands-on you will be able to understand and answer most questions. If you like after watching and hands-on can try some online questions
Can you please give architecture overview?
I will plan a lecture on this Richa
Hi Is this the full course for webdriverIO
Yes Hemanth..can check all topics here ua-cam.com/play/PLhW3qG5bs-L9K2xtu-04jZFqykzXzqJW8.html
i want to test performance of login with multiple user when login the website , can you give me some instruction Thank you so much
Testing the performance of a login process with multiple users is an important step to ensure that your website or application can handle concurrent logins efficiently. Here are some instructions to guide you through the process:
1. Define Your Test Scenario:
- Decide on the number of concurrent users you want to simulate during the test. For example, you might choose 10, 50, or 100 users.
- Determine the login flow you want to test. Consider scenarios like:
- New users registering and logging in.
- Existing users logging in.
- Users with different roles (e.g., regular users, admins) logging in.
2. Choose a Load Testing Tool:
- There are several load testing tools available that can simulate multiple users accessing your website simultaneously. Some popular ones include:
- Apache JMeter: A powerful open-source tool for load testing.
- Gatling: Another open-source tool specifically designed for performance testing.
- Locust: A Python-based load testing framework.
- k6: A modern, developer-friendly load testing tool.
- Pick a tool that suits your requirements and expertise.
3. Create Test Scenarios:
- In your chosen load testing tool, create test scenarios that simulate the login process.
- Define the following parameters for each user:
- Username
- Password
- Any additional data required for login (e.g., CSRF tokens, session IDs)
- Set up the test to run with the desired number of concurrent users.
4. Record or Script the Login Flow:
- If your load testing tool supports recording, use it to record the login flow while manually logging in as a user.
- Alternatively, write custom scripts to simulate the login process. These scripts should include HTTP requests for:
- Navigating to the login page
- Submitting login credentials
- Handling any redirects or subsequent requests (e.g., fetching user data after login)
5. Configure Test Parameters:
- Set the ramp-up time (how quickly users are added) and duration for the test.
- Configure any additional settings, such as think time (delay between requests) and assertions (validating successful login).
6. Execute the Load Test:
- Run the load test with the defined scenarios.
- Monitor server resources (CPU, memory, database connections) during the test.
- Observe response times, error rates, and throughput.
7. Analyze Results:
- Review the load test results. Look for:
- Response times: How long it takes for users to log in.
- Error rates: Any failed logins or unexpected behavior.
- Server resource utilization: Ensure your infrastructure can handle the load.
- Identify bottlenecks (e.g., slow database queries, inefficient code) and address them.
8. Optimize and Retest:
- Based on the results, optimize your login process if needed.
- Retest after making improvements to validate the changes.
Remember that load testing is essential for identifying performance bottlenecks and ensuring your application can handle real-world usage. Good luck with your performance testing
Nice tutorial ❤, can we do web socket chat testing with this automation?
Hi Uzair
No, WebDriverIO is primarily designed for automating web browsers and interacting with web pages using standard HTTP protocols. It does not have built-in support for testing WebSocket connections or performing WebSocket chat testing
WebSocket is a different protocol than HTTP and requires a specialized library or tool to establish and manage the WebSocket connections. WebDriverIO, being focused on browser automation, does not have direct capabilities to handle WebSocket connections.
To test WebSocket chat functionality, you would need to use a testing framework or library that supports WebSocket communication. There are specific libraries available for WebSocket testing, such as 'ws', 'socket.io-client', or 'websocket-client'. These libraries provide the necessary functionality to establish and interact with WebSocket connections.
You can incorporate these WebSocket libraries into your WebDriverIO automation framework to perform WebSocket chat testing. You would need to handle the WebSocket connections separately from WebDriverIO's browser automation capabilities. This may involve establishing WebSocket connections, sending and receiving WebSocket messages, and asserting the expected behavior of the chat functionality.
By combining the WebSocket testing library with WebDriverIO, you can simulate chat interactions and verify the correctness of WebSocket-based chat functionality within your automation tests
hello sir i have one issue , when i try to run test this time "? Could not execute "run" due to missing configuration, file "wdio[.js/.ts]" not found! Would you like to create one? (y/N) " this message was show, how can i resolve this.
Hi Shubham
The error message you encountered suggests that WebDriverIO couldn't find the configuration file (wdio.js or wdio.ts) required to run your tests. To resolve this issue, you can follow these steps:
1. Make sure you have a WebDriverIO configuration file in your project. By default, the configuration file is named `wdio.conf.js` for JavaScript projects or `wdio.conf.ts` for TypeScript projects.
2. If you don't have the configuration file, you can create one by running the following command in your project's root directory:
- For JavaScript: `npx wdio config -y`
- For TypeScript: `npx wdio config tsconfig -y`
This command will generate a basic configuration file with default settings.
3. After creating the configuration file, try running your tests again. The error message should no longer appear, and WebDriverIO should be able to locate and use the configuration file.
If you already have a configuration file and the error persists, please make sure the file is correctly named and located in the root directory of your project. Additionally, ensure that you are running the tests from the correct directory.
By resolving the missing configuration issue, you should be able to run your WebDriverIO tests without encountering the error message
@@RaghavPal Thank you very much sir...that error is resolve but one another error is occuerd
what Shubham
@RaghavPal ; when running the tests i'm seeing the unable to get local issuer certificate error , do you know what will be the reason ?
Hi Vasanth
The error you are getting is because WebdriverIO is unable to find the local issuer certificate. This can happen for a few reasons:
* The certificate may not be installed on your machine.
* The certificate may be expired.
* The certificate may be corrupt.
To fix this, you need to make sure that the certificate is installed on your machine and that it is valid. You can do this by following these steps:
1. Locate the certificate file. The certificate file is typically located in the `/etc/ssl/certs` directory on Linux or macOS, or the `C:\Windows\System32\CertStore\LocalMachine\ROOT` directory on Windows.
2. Import the certificate into your keystore. You can use the `keytool` command to import the certificate into your keystore. For example, to import the certificate into the default keystore on Linux or macOS, you would use the following command:
```
keytool -import -trustcacerts -alias -file
```
* `keytool` is the Java keytool utility.
* `-import` is the import command.
* `-trustcacerts` specifies that the certificate should be trusted.
* `-alias` is the alias for the certificate.
* `-file` is the path to the certificate file.
3. Verify that the certificate is valid. You can use the `openssl` command to verify the certificate. For example, to verify the certificate on Linux or macOS, you would use the following command:
```
openssl verify -CAfile
```
* `openssl` is the OpenSSL command-line tool.
* `verify` is the verify command.
* `-CAfile` is the path to the certificate file.
* `` is the URL of the website that the certificate is for.
If the certificate is valid, you should not see any errors.
If you are still getting the error after following these steps, you may need to contact your system administrator for help.
Hi, when i run npm run wdio command i get following error. i followed your steps twice but same error. what could be the probem . thanks in advance.
Opening in existing browser session.
[0-0] 2023-06-16T15:11:01.524Z ERROR webdriver: Request failed with status 500 due to unknown error: unknown error: Chrome failed to start: exited normally.
[0-0] (unknown error: DevToolsActivePort file doesn't exist)
[0-0] (The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming
that Chrome has crashed.)
[0-0] 2023-06-16T15:11:01.525Z ERROR webdriver: unknown error: unknown error: Chrome failed to start: exited normally.
[0-0] (unknown error: DevToolsActivePort file doesn't exist)
[0-0] (The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming
that Chrome has crashed.)
[0-0] at getErrorFromResponseBody (file:///C:/Projects/webdriverio_project1/node_modules/webdriver/build/utils.js:194:12)
HI Haider
The error message you are getting indicates that Chrome failed to start. There are a few possible reasons for this:
* The ChromeDriver binary is not installed or is not in the path.
* The ChromeDriver binary is not compatible with the version of Chrome that you are using.
* There is a problem with your Chrome installation.
To troubleshoot this issue, you can try the following:
* Make sure that the ChromeDriver binary is installed and is in the path. You can download the ChromeDriver binary from the ChromeDriver website: chromedriver.chromium.org/downloads.
* Check the compatibility of the ChromeDriver binary with the version of Chrome that you are using. You can find the version of Chrome that you are using by opening Chrome and going to `Help > About Google Chrome`.
* Try reinstalling Chrome.
If you have tried all of these things and you are still getting the error, then you may need to contact the WebdriverIO developers for help.
Here are some additional things you can try:
* Restart your computer.
* Clear your Chrome browsing data.
* Run Chrome in compatibility mode.
@@RaghavPal thanks alot , i can run it fine in firefox so i believe its chrome which has the problem. I will try your solutions and see if i can fix chrome issue
sir i want to learn selenium with java through live class. do u take online batches
Anjali
Not taking now,.. you can find all my tutorials here - automationstepbystep.com/
@@RaghavPal but I want live classes one to one . If u know somebody please let me know
Okay, not sure for now, will need to check online
Thank you bro, really useful video
Glad it helped
Great video !!!! Can you please add how to run debug
Hi Archana
To run debug in WebdriverIO, you can use the debug command-line option when running your tests. Here's an example of how you can use it:
npx wdio run wdio.conf.js --spec ./path/to/spec/file.js --debug
This will start the WebdriverIO test runner in debug mode, which will pause execution at the beginning of your test. You can then use your browser's DevTools to step through your code and debug any issues.
You can also set breakpoints in your code using the debugger statement, like this:
it('should do something', () => {
// Some code here
debugger;
// More code here
});
When the debugger statement is hit during execution, the browser will pause and allow you to debug your code using DevTools.
Additionally, you can use the --inspect-brk command-line option to launch a debugger server and attach a debugger to it. Here's an example:
npx wdio run wdio.conf.js --spec ./path/to/spec/file.js --inspect-brk
This will start the WebdriverIO test runner with the debugger server running on port 9229. You can then attach a debugger to this server and debug your code
@@RaghavPal Thank you so much for your explanation and time ❤
@@RaghavPal Sir , I used debugger; statement and --debug command line , but my automation is not pausing at the debugger statement
Archana
If your WebdriverIO automation is not pausing at the debugger statement, there are a few things you can try:
Make sure you have set the --debug flag when running your tests. You can do this by adding --debug to the command you use to run your tests, like so: wdio wdio.conf.js --debug.
Check that your code is actually being executed. The debugger statement will only pause execution if it is actually reached. Make sure that the code block containing the debugger statement is being executed.
Make sure you are using a version of Node.js that supports the --inspect-brk flag. This is required to use the --debug flag in WebdriverIO.
Try using the browser.debug() method instead of debugger. This method will pause the automation and open a browser console, allowing you to inspect the state of the browser and your code.
I hope this helps! Let me know if you have any other questions
Hi sir, I'm not able to generate allure results, as it is showing some errors could you please help me with this ?
will need to check the error messages and logs
Hi Raghav, First of all, the session is great. Thank you for making things easy. Although I am facing an issue in generating an allure report, it is asking me to set a JAVA HOME path. I am a little confused here about why we need the JAVA HOME path to generate the allure report. Could you please explain a bit on that?
Amruta
The Allure report generator requires a Java environment to function correctly. This is because the Allure report is generated using Java code. The JAVA_HOME environment variable specifies the location of the Java Development Kit (JDK) on your system. When you set the JAVA_HOME environment variable, you are telling the Allure report generator where to find the Java runtime environment.
If you do not set the JAVA_HOME environment variable, the Allure report generator will not be able to find the Java runtime environment and will not be able to generate the Allure report.
Here are some instructions on how to set the JAVA_HOME environment variable:
1. **Determine the location of the JDK on your system.** This information can typically be found in the JDK installation documentation.
2. **Set the JAVA_HOME environment variable.** For Windows, you can set the JAVA_HOME environment variable using the System Properties window. For macOS and Linux, you can set the JAVA_HOME environment variable using the export command in your terminal.
3. **Verify that the JAVA_HOME environment variable is set correctly.** You can verify that the JAVA_HOME environment variable is set correctly by opening a terminal window and typing the following command:
```
echo $JAVA_HOME
```
If the command returns the location of the JDK, then the JAVA_HOME environment variable is set correctly.
Once you have set the JAVA_HOME environment variable, you should be able to generate the Allure report without any problems.
Excellent sir
Thanks
Hello Raghav - I am getting ReferenceError: browser is not defined while executing the js file.. can you help out.. what am I missing here ?
Tharini
The `browser` object is not defined in the JavaScript file because it is a WebdriverIO object. WebdriverIO objects are only available in the test runner.
To access the `browser` object in your JavaScript file, you can use the `browser` global variable. The `browser` global variable is created by WebdriverIO when the test runner is started.
For example, if you have the following JavaScript file:
```js
console.log(browser.getTitle());
```
You would get the following error when you try to execute the file:
```
ReferenceError: browser is not defined
```
To fix the error, you would need to change the JavaScript file to use the `browser` global variable:
```js
console.log(global.browser.getTitle());
```
This would print the title of the current page to the console.
Alternatively, you can require the `webdriverio` module in your JavaScript file and then use the `browser` object from the module:
```js
const webdriverio = require('webdriverio');
const browser = webdriverio.browser;
console.log(browser.getTitle());
```
This would also print the title of the current page to the console.
I hope this helps
Thank you for replying promptly , couldn't find this solution elsewhere.. this worked @@RaghavPal
Hi Raghav, I am facing this error when click on the Google search button "Request failed with status 400 due to element not interactable". Please help
Hi Gaurav
The error message "Request failed with status 400 due to element not interactable" in Cypress typically indicates that the element you are trying to interact with (in this case, the Google search button) is not in a state where it can receive user interactions such as clicking.
Here are a few potential reasons for this error and some troubleshooting steps you can try:
Timing issue: Ensure that you are allowing enough time for the page and the element to load completely before interacting with it. You can use Cypress commands like cy.wait(), cy.get().should(), or cy.contains().should() with appropriate assertions to ensure the element is visible and ready to interact with.
Element visibility: Verify that the element you are trying to click is actually visible on the page. Elements that are hidden, covered by other elements, or outside the viewport cannot be interacted with directly. You can use Cypress commands like cy.get().should('be.visible') or cy.get().scrollIntoView() to ensure the element is visible before attempting to click it.
Element availability: Check if there are any conditions or actions that need to be fulfilled before the element becomes interactable. For example, if there is an AJAX request or some dynamic content loading, you may need to wait for the specific condition to be met using Cypress commands like cy.wait(), cy.intercept(), or cy.contains().should().
Frame/ context: If the element is inside an or frame, make sure you switch to the correct context before interacting with it using the cy.frame() command.
Test environment or browser limitations: It's possible that there are specific limitations or restrictions in your test environment or browser that are preventing the element from being interactable. Try running the test in a different browser or updating Cypress to the latest version to see if the issue persists.
By reviewing and addressing these potential causes, you should be able to resolve the "element not interactable" error in Cypress.
I'm sorry but in my chrome i can't see the name of the div, what should i do can i change it with another key or something?
Thank you
Aditya
Yes, you can use what is available. You can also use some recording tools like Se IDE to generate locators
I have facing issue creating allure report, it gives error that it cannot be loaded because running scripts is disabled on this system.... please help me what should I have to do...!!!!!
Hi Wajeeha
The error message "running scripts is disabled on this system" usually indicates that your system's execution policy restricts running PowerShell scripts. To resolve this issue and generate Allure reports in WebDriverIO, you can try the following steps:
1. Open PowerShell as an administrator: Right-click on the PowerShell icon and select "Run as administrator" to open an elevated PowerShell session.
2. Check the current execution policy: In the elevated PowerShell session, run the following command to check the current execution policy:
Get-ExecutionPolicy
It will return the current execution policy for your system.
3. Change the execution policy: If the current execution policy is set to "Restricted" or "AllSigned," you need to change it to "RemoteSigned" or "Unrestricted" to allow running scripts. Run the following command to change the execution policy:
Set-ExecutionPolicy RemoteSigned
Note: Setting the execution policy to "RemoteSigned" allows running local scripts, while "Unrestricted" allows running all scripts without any restrictions. Choose the appropriate level of security based on your requirements.
4. Confirm the changes: After changing the execution policy, run the following command to confirm the updated policy:
Get-ExecutionPolicy
It should display the new execution policy you just set.
5. Generate the Allure report: Try generating the Allure report again using WebDriverIO. The error related to running scripts should no longer occur.
Please note that changing the execution policy may have security implications, so it's essential to understand the potential risks and follow security best practices. It's recommended to consult with your system administrator or IT department before making any changes to the execution policy on a corporate system
Thanks for help... Appreciated
Hi raghav, I'm getting an error like npm not being able to find a file when I typed npm init wdio. Can you suggest me what to do
The error message "npm not being able to find a file" when you type `npm init wdio` in your terminal indicates that there might be an issue with your Node.js environment or the WebdriverIO CLI installation. Here are some steps you can try to troubleshoot and resolve the error:
**1. Verify Node.js and npm installations:**
* Ensure you have Node.js and npm installed and accessible through the command line.
* Check the version of Node.js by running `node -v` in your terminal.
* Ensure the version is compatible with WebdriverIO.
* Check the npm version by running `npm -v`.
* Update npm to the latest version if necessary by running `npm install npm@latest -g`.
**2. Reinstall WebdriverIO CLI:**
* Try reinstalling the WebdriverIO CLI globally using the following command:
```bash
npm install -g @wdio/cli
```
* If the installation fails, try installing it locally within your project directory:
```bash
npm install @wdio/cli
```
**3. Check for conflicting packages:**
* Make sure you don't have any conflicting packages installed, such as an older version of WebdriverIO CLI or a different testing framework.
* Try removing any conflicting packages and try again.
**4. Clear npm cache:**
* Sometimes, the issue might lie with the npm cache. Try clearing the npm cache by running:
```bash
npm cache clean --force
```
**5. Check npm path and permissions:**
* Verify that the npm path is correctly configured in your environment variables.
* Ensure you have sufficient permissions to write to the npm cache and install packages.
**6. Check WebdriverIO version:**
* Ensure you are using the correct WebdriverIO version for your project.
* Try specifying the WebdriverIO version explicitly while initializing the project using:
```bash
npm init wdio@
```
**7. Seek community support:**
* If the above steps don't help, consider seeking assistance from the WebdriverIO community forums or Stack Overflow.
* Provide relevant details like your Node.js and npm version, error message, and any other relevant information to get accurate troubleshooting suggestions.
**Additional notes:**
* Ensure you have all the necessary dependencies for your desired testing framework (e.g., WebDriver, Selenium) installed.
* Double-check the command you typed for typos or incorrect syntax.
* Consider providing more information about your specific situation and the error message for a more accurate diagnosis and solution.
By following these steps and utilizing available resources, you should be able to resolve the "npm not being able to find a file" error and successfully initialize your WebdriverIO project.
Hi Raghav,
I'm unable to generate the allure report and getting the below error:
allure : The term 'allure' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ allure generate .\allure-results\
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (allure:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I have already installed allure commandline with -g option.
Hi
The error message `allure : The term 'allure' is not recognized as the name of a cmdlet, function, script file, or operable program.` means that the `allure` command is not available in your current environment. This can happen for a few reasons:
* The `allure` command is not installed on your computer.
* The `allure` command is not in your current path.
* You are trying to run the `allure` command from a directory that does not have the `allure` command.
To resolve the issue, you can try the following:
1. Check if the `allure` command is installed on your computer. You can do this by running the following command:
```
which allure
```
If the `allure` command is not installed, you can install it using your package manager. For example, if you are using Ubuntu, you can install the `allure` command using the following command:
```
sudo npm install -g allure-commandline
```
2. Check if the `allure` command is in your current path. You can do this by running the following command:
```
echo $PATH
```
The output of this command will show you a list of directories that are in your current path. If the directory where the `allure` command is located is not in your current path, you can add it to your path by editing your `.bashrc` file.
3. Check if you are trying to run the `allure` command from a directory that does not have the `allure` command. You can do this by running the `allure` command from a different directory. If the `allure` command works from a different directory, then the problem is with the directory where you are trying to run the command.
Once you have resolved the issue, you should be able to run the `allure` command without any problems.
However, if you are still getting the error message, it is possible that you are trying to run the `allure` command from a directory that does not have the `npm` command. To check if the `npm` command is installed, you can run the following command:
```
which npm
```
If the `npm` command is not installed, you can install it using your package manager. For example, if you are using Ubuntu, you can install the `npm` command using the following command:
```
sudo apt install npm
```
Once you have installed the `npm` command, you should be able to install the `allure` command without any problems.
If you have installed the `allure` command and it is still not in your path, you can add it to your path by editing your `.bashrc` file. To do this, open your `.bashrc` file in a text editor and add the following line to the end of the file:
```
export PATH=$PATH:/path/to/allure/commandline
```
Once you have saved the `.bashrc` file, you need to reload your shell. You can do this by running the following command:
```
source ~/.bashrc
```
Once you have reloaded your shell, you should be able to run the `allure` command without any problems.
Hi, I am trying to automate a old application of mine.. which has windows authentication and .aspx pages. I am able to bypass windows authentication but when I am trying to redirect to the home.aspx page. It is not loading. Can you help me with this?
Mahesh
If you're facing issues with automating a web application that uses Windows authentication and .aspx pages, and you're able to bypass Windows authentication but encounter problems when redirecting to the `home.aspx` page, there could be several reasons for this behavior. Here are some troubleshooting steps you can follow:
1. **Ensure Correct URL:** Double-check that you're using the correct URL to navigate to the `home.aspx` page. Ensure that the URL is correctly formed and points to the page you intend to access.
2. **Wait for Page Load:** .aspx pages can sometimes have complex rendering, which may take a moment to fully load. Use WebdriverIO's wait methods (e.g., `waitForVisible`, `waitForExist`, or explicit waits) to ensure that the page elements you need are present and visible before interacting with them.
3. **Check for Authentication Cookies:** After bypassing Windows authentication, make sure that any authentication cookies or session data required for accessing protected pages like `home.aspx` are properly set and maintained.
4. **Inspect the Page:** Use browser developer tools to inspect the `home.aspx` page and its elements. Verify that the elements you are trying to interact with are correctly identified using selectors (e.g., CSS selectors or XPath).
5. **Handle AJAX Requests:** If the `home.aspx` page makes AJAX requests to load content dynamically, you may need to handle these requests and ensure that they are completed before interacting with the page. WebdriverIO provides methods for waiting for AJAX requests to complete.
6. **Debugging:** Add logging statements to your automation script to trace the execution flow. This can help identify where the script might be encountering issues.
7. **Check for JavaScript Errors:** Errors in JavaScript code on the page can prevent it from loading or functioning correctly. Check the browser console for any JavaScript errors.
8. **Use Explicit Waits:** Consider using explicit waits with expected conditions to wait for specific elements or events that indicate the `home.aspx` page has fully loaded.
Here's an example of using explicit wait with WebdriverIO:
```javascript
const { browser, $, ExpectedConditions } = require('webdriverio');
// Navigate to the URL
browser.url('example.com/home.aspx');
// Wait for an element to be present before interacting with it
const element = $('#someElementId');
browser.waitUntil(
() => element.isExisting(),
{
timeout: 5000, // Adjust the timeout as needed
timeoutMsg: 'Element not found after 5 seconds',
}
);
// Perform actions on the page
element.click();
```
By following these steps and considering the specific behavior of your application, you should be able to troubleshoot the issue and successfully automate the navigation to the `home.aspx` page. If you encounter specific error messages or issues, please provide more details, and I can offer more targeted assistance.
HI sir
i have downloaded zip file from git and try to run in my local
so now i getting error like
ERROR @wdio/runner: Error: Failed to create session.
[0-0] session not created: This version of ChromeDriver only supports Chrome version 108
[0-0] Current browser version is 120.0.6099.71 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
so i need to change directly in package.js file or need to try with another way?
Rishabh
Here are the steps to resolve the "Failed to create session" error due to ChromeDriver version incompatibility:
1. Check Chrome Version:
- Verify: Open Chrome and go to `chrome://settings/help` to confirm your exact Chrome version (120.0.6099.71 in this case).
2. Download Compatible ChromeDriver:
- Visit Website: Go to [chromedriver.chromium.org/downloads](chromedriver.chromium.org/downloads).
- Match Version: Download the ChromeDriver version that matches your Chrome version (120.0.6099.71).
- Extract: Unzip the downloaded file.
3. Update Project Configuration:
- Specify Path:
- package.json: If using WebDriverIO, locate the `webdriverio` configuration in `package.json` and update the `chromedriver` path to point to the extracted ChromeDriver executable.
- Code: If configuring ChromeDriver in your code, update the path accordingly.
4. Additional Considerations:
- Global Installation: If you prefer a global installation, run `npm install -g chromedriver` to install the compatible version globally.
- Virtual Environment: If using a virtual environment, make sure to install ChromeDriver within that environment.
- Project-Specific Installation: Consider adding ChromeDriver as a project dependency for easier management.
5. Rerun Tests:
- Restart: If necessary, restart your terminal or IDE for changes to take effect.
- Execute Tests: Run your tests again. They should now function correctly with the compatible ChromeDriver.
Key Points:
- Always match ChromeDriver and Chrome versions for smooth operation.
- Regularly check for updates to both Chrome and ChromeDriver to maintain compatibility.
- Consider using tools like `webdriver-manager` to automate ChromeDriver management.
Hi Sir
I am getting error like
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'F:\Evolutyz\WebdriverIO\WebdriverIO_project_1
ode_modules\https-proxy-agent\' imported from F:\Evolutyz\WebdriverIO\WebdriverIO_project_1
ode_modules\geckodriver\dist\install.js
How to slove it
Rishabh
For the issue "Cannot find package 'https-proxy-agent'" error in your WebdriverIO project. Here are the steps to troubleshoot and fix it:
1. Install the Missing Package:
- Open your terminal or command prompt and navigate to your project's root directory.
- Run the following command to install the `https-proxy-agent` package:
```bash
npm install https-proxy-agent
```
2. Clear Cache and Reinstall Dependencies:
- If the package is already installed, clear the npm cache and reinstall dependencies:
```bash
npm cache clean --force
npm install
```
3. Check for Global Installation:
- If you've globally installed `https-proxy-agent`, remove the global installation:
```bash
npm uninstall -g https-proxy-agent
```
- Then, reinstall it locally within your project using `npm install https-proxy-agent`.
4. Address Version Conflicts:
- Review your `package.json` file for any version conflicts between `https-proxy-agent` and other packages.
- Update or resolve conflicts as needed.
5. Verify Import Paths:
- Ensure the import path in `geckodriver/dist/install.js` is correct, pointing to the local `https-proxy-agent` module.
- If necessary, adjust the path based on your project structure.
6. Rebuild Node Modules:
- In rare cases, rebuilding the `node_modules` folder might help:
```bash
rimraf node_modules
npm install
```
Additional Tips:
- Review Logs: Examine any additional error messages or logs for clues.
- Check Permissions: Ensure your user has permissions to install packages in the project directory.
- Seek Community Help: If the issue persists, consult WebdriverIO forums or communities for further guidance.
Hello Raghav, can u make a video of step by step Oracle database testing with webriverio mocha framework
Hi Neelima
I will check if I can plan this, but will not be soon
Do we have a tutorial of how to used data in json and call from json instead of hardcoding the value ? This session is clear absolutely understandable hats off to you for that sir.
Hi raghav,I followed the steps but the test folder is not created for me and while running I am getting error as no specs found to run,exiting with failure
Hi Sindhu,
WebdriverIO expects to find test specs in a specific folder structure by default. The folder structure should look like this:
.
├── wdio.conf.js
└── test
└── myTest.spec.js
If you have not created a test folder with any test specs, you will get the error "no specs found to run".
To resolve this issue, create a test folder in the root of your project and add your test specs in that folder. For example, create a myTest.spec.js file in the test folder:
.
├── wdio.conf.js
└── test
└── myTest.spec.js
Then, run the test again using the following command:
npx wdio wdio.conf.js
This should find your test specs and run them successfully. If you are still having issues, make sure that your wdio.conf.js file is properly configured to point to the correct directory for your test specs.
For some reason whenever i went through the wdio set up it didnt have all of the same options as listed here and once it was set up i didnt have a test file created
Barkley
May be due to version change, can check the documentation
How to install chrome-driver and gecko-driver if no option is displayed on setup And also not able to run login test
Danish
To install ChromeDriver and GeckoDriver if no option is displayed on setup, you can follow these steps:
1. Download the latest versions of ChromeDriver and GeckoDriver from the SeleniumHQ website: www.seleniumhq.org/download/.
2. Unzip the downloaded files.
3. Copy the `chromedriver` or `geckodriver` executable file to the directory where your WebDriverIO tests are located.
4. Update the `desiredCapabilities` object in your WebDriverIO tests to specify the path to the appropriate driver. For example:
```
const capabilities = {
browserName: 'chrome',
chromeOptions: {
args: ['--headless']
}
};
```
5. Run your WebDriverIO tests.
If you are still not able to run the login test, you can try the following things:
* Make sure that you are using the correct version of ChromeDriver and GeckoDriver for the version of Chrome and Firefox that you are using.
* Make sure that the `chromedriver` or `geckodriver` executable file is executable.
* Make sure that the `desiredCapabilities` object in your WebDriverIO tests is correct.
* Check the logs for any errors.
I hope this helps
I'm not seeing Chromedriver and Geckodriver options in the 'Add a service to your test setup' list. However I did manually install and add these services in wdio.conf.js. On running npm run wdio, I'm getting "Failed to initilialise launcher service unknown: Error: Couldn't find plugin "chromedriver" service, neither as wdio scoped package "@wdio/chromedriver-service" nor as community package "wdio-chromedriver-service". Please make sure you have it installed!". Please help!
Shridhar
It looks like you're encountering an issue with the WebdriverIO setup. The error message suggests that the `chromedriver` service plugin is not being recognized. Here's what you can do to resolve this:
1. Ensure Correct Installation: Make sure that you have installed `chromedriver` and `geckodriver` correctly. They should be added as devDependencies in your `package.json` file. You can install them using the following commands:
```bash
npm install chromedriver --save-dev
npm install geckodriver --save-dev
```
2. Update `wdio.conf.js`: Verify that your `wdio.conf.js` file includes `chromedriver` and `geckodriver` in the services array. It should look something like this:
```javascript
exports.config = {
// ...
services: ['chromedriver', 'geckodriver'],
// ...
};
```
3. Check Compatibility: Ensure that the versions of `chromedriver` and `geckodriver` are compatible with the browser versions you are testing against.
4. WebdriverIO Version: If you are using WebdriverIO v8.14 or above, it handles the browser driver setup automatically⁶. You just need to specify the browser you want to test, and WebdriverIO will take care of the rest.
5. Check for Scoped Package: If you are using a scoped package (e.g., `@wdio/chromedriver-service`), ensure that it is installed and listed in your `package.json`.
6. Review Error Message: The error message you provided suggests that the service is not found. If you have recently upgraded WebdriverIO, make sure that any old references to services that are no longer used are removed from your configuration.
7. Community Support: If the issue persists, consider seeking help from the WebdriverIO community. You can find support and discussions related to similar issues which might provide a solution¹¹.
Remember to restart your WebdriverIO service after making changes to the configuration. If you continue to face issues, please share your `wdio.conf.js` file and `package.json` dependencies for a more detailed analysis. This will help in pinpointing the exact cause of the problem.
Hi Raghav, I have setup the sample project and performed the actions to generate allure reports. I see the allure results folder created but when I run allure open the server is running but I don’t see any report in browser. What could be the issue here?
Hi Nidhi,
If you are using WebdriverIO to generate Allure reports and the reports are not showing up in the browser, there are a few things you can check:
Make sure that you have the Allure command line tool installed: You need to have the Allure command line tool installed on your system in order to generate and view reports. You can download the Allure command line tool from the official website.
Check that the path to the Allure results folder is correct: When you run "allure generate", you need to specify the path to the Allure results folder. Make sure that you are specifying the correct path and that the Allure results files are in the correct location.
Check that the Allure server is running: When you run "allure open", it starts a local server that serves the Allure report. Make sure that the server is running and that you are accessing the correct URL. The server should display a message in the terminal indicating that it is running.
Check that your browser is compatible with Allure: Allure supports Google Chrome, Mozilla Firefox, and Microsoft Edge browsers. Make sure that you are using a compatible browser to view the Allure report.
Try opening the report manually: If the Allure server is running but you still can't see the report in the browser, try opening the report manually by navigating to the path where the report is stored in your file system. The path should be something like "allure-report/index.html".
If none of these solutions work, you can try regenerating the Allure report and see if that solves the issue. If you are still having trouble, you may need to seek additional support from the WebdriverIO or Allure communities or consult the WebdriverIO and Allure documentation
Hi Raghav , is there any video where you explain async and await statements? sb told me that await command waits until previous step is finished so then following statements can continue in a sequential order (not in parallel), is this correct or not ?
Hi
Yes, that is correct. The `await` command in JavaScript pauses the execution of the current function until the asynchronous function it is waiting for has completed. This means that the following statements will not be executed until the previous step is finished.
For example, if you have the following code:
```
async function myFunction() {
let result = await someAsyncFunction();
console.log(result);
}
```
The `myFunction()` function will not log the result of the `someAsyncFunction()` function until the `someAsyncFunction()` function has completed. This means that the `console.log()` statement will be executed sequentially, not in parallel.
The `await` command is a powerful tool that can be used to control the flow of asynchronous code. It can help to make your code more readable and easier to debug.
Here are some additional things to keep in mind about the `await` command:
* The `await` command can only be used inside an async function.
* The `await` command can only be used before a promise.
* The `await` command will throw an error if the promise is rejected
Hi Raghav, I practiced with this video. It opened Chrome, but it couldn't locate the search bar and setvalue. It reported an error:
[0-0] error: 'no such element',
[0-0] message: 'no such element: Unable to locate element: {"method":"css selector","selector":"[name="q"]"}
'
In my browser, the search bar is not input but textarea, and I'm not sure if that's the reason
Code in test1.spec.js file:
describe('Demo Test', function () {
it('My First Test', async() => {
browser.url('google.com')
await $('[name="q"]').setValue('WebdriverIO')
browser.pause(2000)
})
})
You are correct. The error message you are receiving is because the search bar is a element, and WebDriverIO is trying to find an element.
The solution is to use the `addValue()` method instead of the `setValue()` method. The `addValue()` method is specifically designed to work with elements.
Here is the modified code:
```javascript
describe('Demo Test', function () {
it('My First Test', async () => {
browser.url('google.com')
// Instead of using setValue, use addValue to interact with the textarea
await $('[name="q"]').addValue('WebdriverIO')
browser.pause(2000)
})
})
```
This code should now be able to locate the search bar and set the value to "WebdriverIO".
I hope this helps
@@RaghavPal thanks, that's helpful.
Hi raghav,
I followed all the steps u mention when I run the command allure open the browser gets launched and opens allure report page but it doesn't have data it's showing allure report unknown and 0 test cases..can you help me on this
Hi Durga,
To resolve the issue of the allure report having no data, you can try the following steps:
Check that the Allure adapter is installed correctly and is included in the wdio.conf.js file.
Ensure that the allure commands are properly integrated in the test code.
Make sure that the allure-results folder has the generated data
If there is still no data in the report, try regenerating the report with the allure generate command
If the issue still persists, check the version compatibility between WebdriverIO, the allure adapter, and the allure CLI. Upgrade to the latest version if necessary
Hi Raghav , Great session as it very understanding but I am facing some issue while doing setup , whenever i run the command "npm run wdio"
it is giving me an error as
"npm ERR! code ENOENT
npm ERR! syscall spawn C:\Program Files\Java\jdk1.8.0_261\bin
npm ERR! path C:\Program Files\WebdriverIO
npm ERR! errno -4058
npm ERR! enoent spawn C:\Program Files\Java\jdk1.8.0_261\bin ENOENT
npm ERR! enoent This is related to npm not being able to find a file."
Please help me in this
Shubham
Here are the potential causes and steps to resolve it:
1. Missing or Incorrect Java Path:
- Verify Java Installation: Ensure Java is installed at the specified path (`C:\Program Files\Java\jdk1.8.0_261\bin`).
- Check Environment Variables:
- Open System Properties (or Environment Variables) and locate the `JAVA_HOME` variable.
- Make sure it points to the correct Java installation directory.
- If it's missing, create it and set the value.
- Also, ensure `%JAVA_HOME%\bin` is added to your PATH variable.
2. Permissions Issue:
- Run as Administrator: Try running the command prompt or terminal as an administrator.
- Check File Permissions: Ensure your user account has read and execute permissions for the Java directory and files.
3. Conflicting npm Scripts:
- Review `package.json`: Examine your `package.json` file to ensure the `wdio` script is defined correctly and doesn't have conflicts with other scripts.
4. npm Configuration:
- Check npm Config: Run `npm config list` to review your npm configuration.
- Adjust `prefix`: If the `prefix` setting is incorrect, it might interfere with finding files.
5. Reinstall Dependencies:
- Clear Cache and Reinstall: Clear npm's cache using `npm cache clean --force` and reinstall dependencies with `npm install`.
6. npm and Node.js Version:
- Upgrade npm: Consider upgrading npm to the latest version using `npm install -g npm`.
- Check Node.js Compatibility: Verify that your Node.js version is compatible with your WebdriverIO and other project dependencies.
Additional Tips:
- Inspect Error Logs: Check for more detailed error messages in npm or WebdriverIO logs.
- Try Different Terminal: Experiment with different terminals or command prompts.
How to automate installed electron application (.exe)?
Nishan
Let's break down the steps to automate an installed Electron application (.exe) using WebdriverIO:
Step 1: Install WebdriverIO and required dependencies
* Install WebdriverIO using npm by running the command `npm install webdriverio`
* Install the chromedriver package using `npm install chromedriver` (since Electron apps use Chromium)
Step 2: Set up the Electron application
* Make sure the Electron application is installed and running on your system
* Identify the executable path of the Electron application (e.g., `C:\Path\To\App.exe`)
Step 3: Configure WebdriverIO to interact with the Electron application
* Create a new WebdriverIO configuration file (e.g., `wdio.conf.js`) with the following settings:
```javascript
export const config = {
//...
capabilities: [{
browserName: 'chrome',
chromeOptions: {
binary: 'C:\\Path\\To\\App.exe', // path to the Electron app executable
args: ['--disable-dev-shm-usage', '--no-sandbox'] // optional args to stabilize the session
}
}],
//...
};
```
In this configuration, we're telling WebdriverIO to use the Chrome browser (since Electron apps are built on Chromium) and specifying the path to the Electron application executable.
Step 4: Write a test script to interact with the Electron application
* Create a new test file (e.g., `app.test.js`) and import the WebdriverIO client:
```javascript
const { client } = require('webdriverio');
describe('Electron App Automation', () => {
it('should launch the app and perform some action', async () => {
const browser = await client.init();
// Perform some action on the app, e.g., click a button
await browser.click('#some-button');
// Verify the expected outcome
await browser.waitUntil(async () => {
const text = await browser.getText('#some-element');
return text === 'Expected text';
});
await browser.deleteSession();
});
});
```
In this example, we're launching the Electron application using WebdriverIO, performing some action (e.g., clicking a button), and verifying the expected outcome.
Step 5: Run the test script
* Run the test script using the command `npx wdio app.test.js` (assuming your test file is named `app.test.js`)
-
@@RaghavPal Thank you very much for your reply. My electron app Chrome browser version is 13. How can we manage this?
Not very sure.. will need to check online Nishan
Your videos are very informative and useful for the entire testers community. I am having following issue.
"Appium exited before timeout.exit code : null." How to fix this error? Can I have the solution? I increased the timeouts also, but still it exists.
Nodejs version : 20.3.1
Wdio version : 8.36.1
Appium version : 2.5.4
To fix the "Appium exited before timeout" error in WebdriverIO with Appium, consider the following solutions:
1. Update `wdio.conf.js`:
- Add the following properties to your `wdio.conf.js` file:
```javascript
// Inside the config object
capabilities: [{
// Other capabilities...
'appium:noReset': true, // Prevent app reset between sessions
'appium:newCommandTimeout': 60000, // Set a longer command timeout (adjust as needed)
}],
```
- These settings ensure that Appium doesn't reset the app and allows sufficient time for commands.
2. Check Appium Server Logs:
- Run Appium server separately (outside WebdriverIO) and observe its logs.
- Look for any specific errors or warnings related to timeouts or unexpected exits.
- Adjust your configuration based on the logs.
3. Verify Dependencies:
- Ensure that your Node.js, WebdriverIO, and Appium versions are compatible.
- Update any outdated dependencies.
Remember to apply these changes and retry your tests.
@@RaghavPal Thanx brother. I will apply your solutions. If anything else, I contact u. Can I have the compatibility matrix list for wdio,nodejs and appium? It will be more helpful for me.
Sure, if you are using the latest versions, this should work
WebdriverIO Latest stable version
Node.js ^14.17.0
Appium Latest stable version
@@RaghavPal nodejs 14.17.0
Wdio 8.36.1
Appium 2.5.4
Will these combinations compatible? Or u suggest any specific versions.
should work.. try it
Hi Raghav sir, thanks for the awesome info, have one doubt, do we really need to name the test files as abc.spec.js instead of abc.js because I see the suggestions are more elaborate with first approach like you did.
Hi Anil
In WebdriverIO, the convention is to name the test files with a `.spec.js` extension. While it is not strictly required to follow this naming convention, it is a best practice that helps to easily identify and differentiate test files from other JavaScript files in your project.
The `.spec.js` extension is commonly used to indicate that the file contains test specifications or test cases. It helps in organizing and maintaining the test files within the project structure. Additionally, many testing frameworks and tools, including WebdriverIO, automatically search for files with a `.spec.js` extension when running tests.
However, if you prefer a different naming convention or want to use a different file extension for your test files, you can customize it according to your project's needs. Just make sure to configure your testing framework or runner to look for the appropriate file extension when executing the tests.
Remember that consistency and clarity in naming conventions can make your test suite more maintainable and easier to understand for you and your team.
सर मेने आपके चैनल के बहुत सारे वीडियो देखें है आप बहुत अच्छे से समझाते हो ।
मुझे एक प्रश्न का जवाब देदो तो आपकी बड़ी कृपा होगी
मेने एक गूगल शीट में फार्मूला लगाकर income tax सम्बन्धी यूटिलिटी/सॉफ्टवेयर बनाया है जिसमे नॉर्मली डाटा फीड करने पर पूरा हिसाब किताब कैलकुलेट होकर आता है ।
अब मैं चाहता हु की यही काम एक वेबसाइट पर करू जिसमे डाटा फीड करू ओर डाटा कैलकुलेट होकर यूजर को मिल जाए ।
कृपया सर इस सम्बंध में मुझे मार्गदर्शन प्रदान करें या आपके अनुभव के आधार पर आईडिया देवे आपकी बड़ी कृपा होगी ।
निश्चित नहीं। ऑनलाइन चेक करना होगा
@@RaghavPal ok ji
Love your videos!!! Thanks
You are so welcome Sohaib
sir can we able to automate flutter app??
sir waiting for your replay?
Hi Chethuhari,
WebdriverIO may not be the best tool for this.
To automate Flutter applications, you can use the Flutter driver.
thanks a lot Sir
Most welcome
I'm getting error can u help me out
Please send me details
Thank you sir
Most welcome Imran
In services im not getting drivers
Jyōthīßh
There are a few possible reasons why you are not getting drivers in your WebdriverIO services:
* You have not installed the required driver packages.
* You have not configured your WebdriverIO configuration file correctly.
* There is a problem with the driver installation.
To troubleshoot the issue, you can try the following:
1. Make sure that you have installed the required driver packages. You can find the list of required driver packages in the WebdriverIO documentation.
2. Check your WebdriverIO configuration file to make sure that you have configured your services correctly. You can find information on how to configure your services in the WebdriverIO documentation.
3. Try restarting your computer.
4. Try running your tests in a different terminal or command prompt.
5. Search for help online. There are many resources available online that can help you to troubleshoot WebdriverIO errors.
If you are still having trouble, please provide me with more information about your setup, such as your WebdriverIO version, operating system version, and the specific error message that you are getting. I will try my best to help you resolve the issue.
Here are some additional tips for getting drivers in your WebdriverIO services:
* Use a service manager such as `wdio-local-runner` or `wdio-docker-runner` to manage your WebdriverIO services. These services will automatically download and install the required drivers for you.
* Use a cloud-based testing service such as Sauce Labs or BrowserStack. These services provide you with access to a wide range of browsers and operating systems, and they will automatically manage the drivers for you.
* Use a headless browser such as Puppeteer or Chrome Headless. These browsers do not require a graphical user interface, so they do not require any drivers.
I hope this helps
@@RaghavPal thank you I will try and let u know
Everything was correct still getting same error like unable to get local issuer certificate
will need take some online help here
Code not visible properly due to subtitles
will need more details and context to help on this Sunil
Anyone who had error while running this command due to permission denied on mac
npm install -g allure-commandline --save-dev
Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
Solution:
1)
first know your whoami by running command in terminal
whoami
user_name
2)
then, change ownership of these 3 directories to the above user_name (your user)
sudo chown -R user_name /usr/local/lib/node_modules/
sudo chown -R user_name /usr/local/bin/
sudo chown -R user_name /usr/local/share/
and the EACCES error will go away.
Thanks for adding
sir ur audio level is very down pls improve this .
I will take care of this Ashramita. Also check the volume is up in youtube player and laptop
Hey, is there any video how to setup webdriverio with appium for android automation? @RaghavPal
I have not created this one Farhana
@@RaghavPal it will be helpful if you make a video on this.
I will plan
Hi, thank you for spreading the knowledge with your clear and easy to follow videos! I do have a problem I hope you can help me with. All has gone well until I am trying to generate the report. I then get the following error and even with uninstalling, and re installing multiple times (globally or locally) I get the same error. Any help would be truly appreciated. Thank you in advance, Harjit
PS C:\WebDriverIO\WebDriverIO_Project1> allure generate .\allure-results\
node:internal/child_process:421
throw new ErrnoException(err, 'spawn');
^
Error: spawn EINVAL
at ChildProcess.spawn (node:internal/child_process:421:11)
at Object.spawn (node:child_process:761:9)
at module.exports (C:\Users\Harji\AppData\Roaming
pm
ode_modules\allure-commandline\index.js:7:37)
at Object. (C:\Users\Harji\AppData\Roaming
pm
ode_modules\allure-commandline\bin\allure:5:1)
at Module._compile (node:internal/modules/cjs/loader:1368:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
at Module.load (node:internal/modules/cjs/loader:1205:32)
at Module._load (node:internal/modules/cjs/loader:1021:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12)
at node:internal/main/run_main_module:28:49 {
errno: -4071,
code: 'EINVAL',
syscall: 'spawn'
}
Node.js v21.7.3
It seems you're encountering an error while trying to generate an Allure report using WebDriverIO. The error message indicates an issue related to spawning a process. Let's troubleshoot this step by step:
1. Check Node.js Version Compatibility:
- The error message shows that you're using Node.js version 21.7.3.
- Ensure that your WebDriverIO project is compatible with this Node.js version. Some packages or tools may not work correctly with the latest Node.js versions.
- Consider downgrading to a stable LTS (Long-Term Support) version (e.g., Node.js 14.x or 16.x).
2. Reinstall Allure Command Line:
- Since you've already tried uninstalling and reinstalling, let's ensure you have the correct version of Allure Command Line.
- Run the following command to install Allure globally (if not already done):
```
npm install -g allure-commandline
```
3. Check Allure Configuration:
- Verify that your `wdio.conf.js` configuration includes the Allure reporter and specifies the output directory:
```javascript
// wdio.conf.js
exports.config = {
// Other configuration options...
reporters: [['allure', {
outputDir: './allure-results',
disableWebdriverStepsReporting: true,
disableWebdriverScreenshotsReporting: false,
}]],
// ...
};
```
- Make sure the `outputDir` points to a valid directory where Allure results will be generated.
4. Run Allure Generate Command:
- Navigate to your project directory where the `allure-results` folder exists.
- Run the following command to generate the Allure report:
```
allure generate --clean
```
- This command will process the results in the `allure-results` folder and create the report files.
5. Open the Allure Report:
- After generating the report, run the following command to open it in your default web browser:
```
allure open
```
6. Additional Considerations:
- If you're using any custom hooks or scripts related to Allure, review them for any potential issues.
- Check if there are any conflicting global installations of Allure or other packages.
Remember to adjust the Node.js version and ensure that your project dependencies are correctly set up
@@RaghavPal Hello again! Thank you for your advice and help and sincere apologies for not responding sooner.
I ran through the tutorial again from scratch using the same versions as per your recording but found I was still having the same issue.
After a bit of digging I found the allure generate command would only work if it is run on the command prompt and in the location "C:\WebDriverIO\WDIO_Project1
ode_modules\allure-commandline\dist\bin" (but not VSCode terminal). I am guessing that must be because this is where the allure.bat file is. Can you advise what I am missing to make it work within VSCode?
In order to generate the report I would have to provide the full path to the results folder using the command "allure generate C:\WebdriverIO\WDIO_Project1\allure-results\" which would then create the report folder in "C:\WebdriverIO\WDIO_Project1
ode_modules\allure-commandline\dist\bin\allure-report"
I was then able to run "allure open" to see the report :)
If you have the time, please could you advise how to make this run within VSCode terminal window.
Thank you again and kind regards, Harjit
It's great that you were able to generate the Allure report using the command prompt! Let's address how to make it work within the Visual Studio Code (VSCode) terminal.
The issue you're facing might be related to the environment variables or the working directory. Here are some steps to troubleshoot and ensure that Allure commands work seamlessly within the VSCode terminal:
1. Check Allure Installation:
- First, make sure you have Allure installed globally on your system. You can install it using npm:
```
npm install -g allure-commandline
```
- Verify that you can run `allure --version` successfully in the VSCode terminal.
2. Working Directory:
- When running commands in VSCode, the working directory matters. Ensure that you are in the correct project directory (e.g., `C:\WebdriverIO\WDIO_Project1`) when executing Allure commands.
- You can change the working directory in the VSCode terminal using the `cd` command:
```
cd C:\WebdriverIO\WDIO_Project1
```
3. Path to Allure Executable:
- If Allure is installed globally, you should be able to run it from any directory. However, if you want to use a local installation (within your project), you can specify the full path to the Allure executable:
```
node_modules\.bin\allure generate allure-results --clean -o allure-report
```
Replace `node_modules\.bin\allure` with the correct path relative to your project.
4. Environment Variables:
- Check if the path to the Allure executable is included in your system's `PATH` environment variable. If not, add it manually.
- Restart VSCode after modifying environment variables to ensure they take effect.
5. VSCode Terminal Settings:
- Sometimes, VSCode terminal settings can cause issues. Make sure you haven't accidentally set any custom configurations.
- You can also try opening a new terminal in VSCode (hit the "+" button in the terminal panel) to see if that resolves the issue.
6. Permissions:
- Ensure that you have the necessary permissions to execute commands in the VSCode terminal.
- If you encounter permission errors, try running VSCode as an administrator.
Remember to follow these steps, and you should be able to run Allure commands directly within the VSCode terminal
i got new error "ERROR webdriver: RequestError: getaddrinfo ENOTFOUND localhost & ERROR @wdio/runner: Error: Failed to create session." how i can resolve that
Hi Shubham
The error message "ERROR webdriver: RequestError: getaddrinfo ENOTFOUND localhost" indicates that the WebDriver is unable to resolve the hostname "localhost" to an IP address. This typically happens when the WebDriver is unable to connect to the specified URL or when the URL is incorrect.
Here are a few steps you can take to resolve this issue:
1. Verify the URL: Double-check the URL you are providing to the WebDriver. Make sure it is correct and properly formatted. Ensure that "localhost" is spelled correctly and that there are no typos in the URL
2. Check the WebDriver configuration: Review your WebDriver configuration and ensure that the hostname and port settings are correctly specified. Ensure that the WebDriver is configured to connect to the correct URL and port where your application is running
3. Check network connectivity: Ensure that your machine has network connectivity and is able to resolve hostnames. Test network connectivity by trying to access the same URL manually in a web browser or using tools like cURL or Postman. If you are unable to access the URL, there may be a network configuration issue that needs to be resolved
4. Check application availability: Ensure that your application is running and accessible at the specified URL. Make sure the application is started and listening on the expected port. If the application is not running or is not accessible, the WebDriver won't be able to establish a connection
5. Check proxy settings: If you are using a proxy server to connect to the internet, make sure your WebDriver is configured to use the correct proxy settings. Improper proxy configuration can lead to connection issues
6. Firewall and security settings: Check if there are any firewall or security settings that may be blocking the connection to the specified URL. Temporarily disabling firewalls or adjusting security settings can help diagnose if they are causing the issue
By following these steps, you should be able to troubleshoot and resolve the "RequestError: getaddrinfo ENOTFOUND localhost" error
@@RaghavPal hello sir thank you very much for your valuable replay this really help me, this error is resolved. but new error was occured is "TypeError in "My Login application.should login with valid credentials"
TypeError [ERR_INVALID_URL]: Invalid URL" this is the error
Shubham
The error message "TypeError [ERR_INVALID_URL]: Invalid URL" indicates that the URL that you are trying to use is not valid. This could be due to a number of reasons, such as a typo in the URL, or the URL being for a resource that does not exist
To troubleshoot this error, you can try the following:
1. Check the URL that you are using to make sure that it is correct
2. Try using a different URL to access the resource
3. Make sure that the resource that you are trying to access is actually available
If you are still getting the error after trying these steps, you can contact WebdriverIO support for help.
Here are some possible reasons why you might be getting this error:
* You are trying to use a URL that is not valid
* The resource that you are trying to access is not available
* There is a problem with your network connection
* There is a problem with WebdriverIO
If you are sure that the URL is valid and the resource is available, you can try the following to troubleshoot the problem:
* Check your network connection.
* Restart your computer.
* Update WebdriverIO.
* Contact WebdriverIO support for help
@@RaghavPal hello this error is resolve, was error occures becuse of mistake in base url. Thank you very much.
I'm.getting invalid arg type error
Hello Raghav, when I type npm init wdio I get an error, I hace ndm and node installed, The issue is
npm ERR! code ENOENT
' +
'npm ERR! syscall lstat
' +
'npm ERR! path C:\\Users\\user\\AppData\\Roaming\
pm
' +
'npm ERR! errno -4058
' +
"npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\\Users\\user\\AppData\\Roaming\
pm'
" +
'npm ERR! enoent This is related to npm not being able to find a file.
' +
'npm ERR! enoent
' +
Maria
For "ENOENT" error you're encountering when running `npm init wdio`. Here are the steps to troubleshoot:
1. Address Missing Directory:
- Create Missing Directory: Manually create the missing directory using your command prompt:
```bash
mkdir C:\Users\user\AppData\Roaming
pm
```
2. Reinstall Node.js and npm:
- Consider Reinstallation: If the directory issue persists, a clean reinstallation of Node.js might be necessary. This often rectifies corrupted installation files or incorrect configurations.
3. Check Environment Variables:
- Verify PATH: Ensure the `npm` path is included in your PATH environment variable. You can check and adjust this through System Properties > Environment Variables.
4. Run as Administrator:
- Elevated Privileges: Attempt running the command prompt or terminal as an administrator to overcome potential permission restrictions.
5. Clear Cache:
- Refresh npm Cache: Clear the npm cache using `npm cache clean --force`.
6. Resolve Conflicts:
- Manage Multiple Versions: If you have multiple Node.js or npm versions, ensure you're using the intended ones and avoid conflicts.
@@RaghavPal thank you!