WebdriverIO How to implement Page Object Model

  Рет қаралды 18,472

Automation Step by Step

Automation Step by Step

Күн бұрын

Пікірлер: 50
@einstein6451
@einstein6451 Жыл бұрын
Thank you so much Raghav!
@RaghavPal
@RaghavPal Жыл бұрын
Most welcome 🤗
@sumit44442
@sumit44442 Жыл бұрын
superb explanation sir
@RaghavPal
@RaghavPal Жыл бұрын
Thanks Sumit
@manishkannamoney7455
@manishkannamoney7455 Жыл бұрын
Superb! Explanation Sir, But can u explain initial Plugins and settings are needed in Eclipse.Please Suggest to me.Thanks in advance
@RaghavPal
@RaghavPal Жыл бұрын
Hi Manish, on eclipse you will need *Eclipse Webdriver Plugin* To install the Eclipse WebDriver plugin, open Eclipse and go to the "Help" menu. Select "Eclipse Marketplace" and search for "WebDriver." Click "Install" to install the plugin
@prabakarann2644
@prabakarann2644 8 ай бұрын
Hello sir ... do we have any video that support/handles POM when we have cucumber Stepdefenitions already in place ...? if so , pls share the link here sir
@RaghavPal
@RaghavPal 8 ай бұрын
Praba I believe its not there as of now
@saranyababu1359
@saranyababu1359 Жыл бұрын
Hello , Cant we use xpath locator in webdriver IO . am getting Unexpected token error in IDE
@RaghavPal
@RaghavPal Жыл бұрын
Hi Saranya WebDriverIO does support XPath locators for finding elements on a web page. If you are getting an "Unexpected token" error in your WebDriverIO IDE, it might be due to a syntax issue in your code. Make sure you are using the correct syntax for XPath locators. Here's an example of how to use XPath locator in WebDriverIO: ```javascript // Import WebDriverIO and set up browser configuration const { remote } = require('webdriverio'); const options = { capabilities: { browserName: 'chrome', }, }; // Start a WebDriverIO session (async () => { const browser = await remote(options); try { // Navigate to a web page await browser.url('www.example.com'); // Using XPath to locate an element and perform an action const submitButton = await browser.$('//input[@type="submit"]'); await submitButton.click(); // More actions and assertions can be performed here } catch (error) { console.error('Error occurred:', error); } finally { // Close the WebDriverIO session await browser.deleteSession(); } })(); ``` In the above example, we use the XPath `//input[@type="submit"]` to locate a submit button on the web page. The XPath syntax is correct, and WebDriverIO should be able to execute it without any issues. If you are still facing issues, please ensure that your XPath expression is correct, and there are no syntax errors in your code. Also, double-check if all the required dependencies are installed in your project, and WebDriverIO is properly configured
@saranyababu1359
@saranyababu1359 Жыл бұрын
@@RaghavPal No Sir. Its not accepting anything other than CSS . I tried XPath, Name .. Getting error for other than CSS . Is this releated to ES versions
@RaghavPal
@RaghavPal Жыл бұрын
ok, will need to check more on this online
@Slitek1
@Slitek1 Жыл бұрын
Hi, I am not writing comments too often but for Your work - I have to do this. Thank You for the genious explanation of all steps, can't wait for more materials from You regarding to webdriverio. Just please - don't stop this work :)
@RaghavPal
@RaghavPal Жыл бұрын
Most welcome
@leoamato6113
@leoamato6113 Жыл бұрын
great!
@RaghavPal
@RaghavPal Жыл бұрын
Thanks for watching Leo
@NITINN-ne9ze
@NITINN-ne9ze Жыл бұрын
sir i why is my testscript getting skipped please help
@RaghavPal
@RaghavPal Жыл бұрын
Hi Nitin There are a few reasons why your test script might be getting skipped in WebDriverIO. Here are some of the most common reasons: * **The test is marked as skipped.** You can mark a test as skipped by using the `it.skip()` or `describe.skip()` method. This will cause the test to be skipped, and it will not be executed. * **The test is not defined.** If the test is not defined, it will be skipped. This can happen if you have a typo in the test name, or if you have deleted the test from your code. * **The test is not enabled.** You can enable or disable tests by using the `it.enabled()` or `describe.enabled()` method. If a test is disabled, it will be skipped. * **The test is not applicable.** If a test is not applicable to the current environment, it will be skipped. This can happen if you are running the test on a different browser or platform than the one that the test was written for. To figure out why your test script is getting skipped, you can use the `debugger` command in WebDriverIO. This will stop the execution of the test script, and you can inspect the variables and the code to see why the test is being skipped. Here are some additional tips for debugging skipped tests in WebDriverIO: * **Use the debugger.** The debugger can be a great way to debug skipped tests. You can use the debugger to inspect the variables and the code to see why the test is being skipped. * **Check the test code.** Make sure that the test code is valid and that it is not marked as skipped. * **Check the environment.** Make sure that the test is being run on the correct environment. * **Check the logs.** The logs can often provide clues as to why a test is being skipped. I hope this helps!
@nitinshiva6868
@nitinshiva6868 Жыл бұрын
Thanks sir I will check ur sessions are awesome enjoying learning with your vedio thanks a lot for this
@tuangkarombang5315
@tuangkarombang5315 6 ай бұрын
Thanks a lot Sir, but can you give me more detail about Allure?
@RaghavPal
@RaghavPal 6 ай бұрын
Allure is a powerful reporting library that integrates seamlessly with WebdriverIO to create beautiful and informative test reports. Let's dive into the details: 1. Installation: - To use the Allure reporter with WebdriverIO, follow these steps: - Add `@wdio/allure-reporter` as a devDependency in your `package.json`: ```json { "devDependencies": { "@wdio/allure-reporter": "^7.0.0" } } ``` - Install it using: ```bash npm install @wdio/allure-reporter --save-dev ``` 2. Configuration: - In your `wdio.conf.js` file, configure the output directory for Allure reports: ```javascript export const config = { // ... reporters: [ ['allure', { outputDir: 'allure-results', disableWebdriverStepsReporting: true, disableWebdriverScreenshotsReporting: true, }], ], // ... } ``` - The `outputDir` defaults to `./allure-results`. - After a test run, you'll find an `.xml` file for each spec, along with other attachments like `.txt` and `.png` files in the specified directory. 3. Customization: - You can further customize the Allure reporter using the following optional parameters: - `disableWebdriverStepsReporting`: Set to `true` if you want to log only custom steps to the reporter. - `issueLinkTemplate`: Specify the issue link pattern (e.g., `[4](example.org/issue/){}`). - `tmsLinkTemplate`: Specify the Test Management System (TMS) link pattern (e.g., `[5](example.org/tms/){}`). - `disableWebdriverScreenshotsReporting`: Set to `true` to exclude screenshots from the reporter. - `useCucumberStepReporter`: Set to `true` when using Cucumber to adjust the report hierarchy. - `disableMochaHooks`: Set to `true` to exclude before/after hooks from the Allure Reporter. - `addConsoleLogs`: Set to `true` to attach console logs from steps to the reporter. - `reportedEnvironmentVars`: Display environment variables in the report. For more detailed documentation, you can refer to the official Allure Report Docs .
@xXMrThomasXx
@xXMrThomasXx 2 ай бұрын
Thx for the next part :)
@RaghavPal
@RaghavPal 2 ай бұрын
Hope you enjoyed it
@cuckoophilip6275
@cuckoophilip6275 Жыл бұрын
Hi Raghav, When I run the login test, I get the error "selector needs to be typeof `string` or `function`". Could you please suggest how to bypass it?
@RaghavPal
@RaghavPal Жыл бұрын
Hi The error "selector needs to be typeof `string` or `function`" means that the selector that you are passing to the `WebDriverIO` API is not of the correct type. The selector needs to be either a string or a function. Here are some possible solutions to this error: * **Make sure that the selector is a string.** If the selector is a string, make sure that it is enclosed in quotes. For example, the following selector is a string: `"#username"`. * **Make sure that the selector is a function.** If the selector is a function, make sure that it returns a string. For example, the following function is a selector: `function(el) { return el.querySelector("#username"); }`. * **Use the `By` class to create a selector.** The `By` class provides a number of static methods that you can use to create selectors. For example, the following code uses the `By.cssSelector()` method to create a selector: `By.cssSelector("#username")`. Here is an example of how to bypass the error "selector needs to be typeof `string` or `function`" in WebDriverIO: ```python import webdriverio def login(driver): # Get the username input field. username_input = driver.findElement(By.cssSelector("#username")) # Enter the username. username_input.sendKeys("admin") # Get the password input field. password_input = driver.findElement(By.cssSelector("#password")) # Enter the password. password_input.sendKeys("password") # Click the login button. driver.findElement(By.cssSelector("#login")).click() if __name__ == "__main__": driver = webdriverio.webdriver.Chrome() login(driver) driver.quit() ``` This code will first get the username input field and then enter the username. Then, it will get the password input field and then enter the password. Finally, it will click the login button. I hope this helps
@МаринаК-ы6ю
@МаринаК-ы6ю 6 ай бұрын
Thank s a lot! Your video helped me to understand what is POM, how to implement it and why it is useful! Thank you again!
@RaghavPal
@RaghavPal 6 ай бұрын
Glad it helped..
@gabrielmarques-qx1xk
@gabrielmarques-qx1xk Жыл бұрын
Excellent video, man, very useful and straight to the point, thank you!
@RaghavPal
@RaghavPal Жыл бұрын
Most welcome Gabriel
@Floweenka
@Floweenka Жыл бұрын
explained very nicely, thanks a lot!
@RaghavPal
@RaghavPal Жыл бұрын
Most welcome Floweenka
@RaveenaSingal
@RaveenaSingal 5 ай бұрын
Please help me to resolve this issue ERROR @wdio/runner: Error: Unable to load spec files quite likely because they rely on `browser` object that is not fully initialised. [0-0] `browser` object has only `capabilities` and some flags like `isMobile`. [0-0] Helper files that use other `browser` commands have to be moved to `before` hook. [0-0] Spec file(s): file:///C:/Users/VSG/Desktop/WebDriverIO/WebDriverIO_Project_1/test/specs/loginpotest.js
@RaghavPal
@RaghavPal 5 ай бұрын
Raveena The error you're encountering with WebDriverIO suggests that the `browser` object is being used before it's fully initialized. This typically happens when commands that rely on the `browser` object are placed outside of test hooks (`before`, `beforeEach`, `after`, `afterEach`) or test blocks (`it`). Here's what you can do to resolve this issue: 1. Move any setup code that uses the `browser` object into the `before` or `beforeEach` hooks. This ensures that the `browser` object is fully initialized before any commands are called. 2. Ensure that your spec file and the respective page file are kept in a similar folder structure to avoid path-related issues 3. Check your imports and remove any that are not necessary, as unwanted imports can sometimes cause issues Here's an example of how you might structure your code: ```javascript describe('Login Page Test', () => { before(() => { // Initialization code that needs to run before the spec file is executed browser.url('your_login_page_url'); }); it('should allow a user to log in', () => { // Your test code here }); // ... other hooks and test blocks }); ``` Make sure that any command that interacts with the `browser` object is within an `it` block or appropriate hooks. If you follow these steps and the issue persists, it could be helpful to look at the specific code in your `loginpotest.js` file to identify any commands that might be incorrectly placed outside of test blocks or hooks.
@NikahatFatima-o2k
@NikahatFatima-o2k 11 ай бұрын
Excellent video with all coding explanation thank you
@RaghavPal
@RaghavPal 11 ай бұрын
Most welcome Nikahat
@hrushitelugu-techlogics5334
@hrushitelugu-techlogics5334 Жыл бұрын
hi Raghav sir, I am Hrushikesh studying in class 9th. I am a great admirer of your classes. Now I am learning webdirverio. But I wish to learn it with typescript without using javascript. please can you provide the video tutorial to set up a frame work to test a web application using webdriver and typescript compiler but not javascript. Please Please 🙏🙏🙏🙏🙏🙏🙏🙏🙏
@RaghavPal
@RaghavPal Жыл бұрын
Hi Hrushi, this is great to know that you have started at an early age. I will plan to create WebdriverIO videos with TypeScript
@hrushitelugu-techlogics5334
@hrushitelugu-techlogics5334 Жыл бұрын
@@RaghavPal Thank You sir for your love. Please make it as soon as possible. I will be waiting for your tutorials which makes the students like me brighter and efficient in coding. Thank you......
@Anishkcs
@Anishkcs Жыл бұрын
Thank you Raghav for POM session.
@RaghavPal
@RaghavPal Жыл бұрын
Most welcome
@jollywgiant1760
@jollywgiant1760 Жыл бұрын
Very helpful, thanks :)
@RaghavPal
@RaghavPal Жыл бұрын
Most welcome
@TheVihangasathsara
@TheVihangasathsara Жыл бұрын
Please help me to resolve this issue 🙏🙏 ERROR @wdio/runner: Error: Unable to load spec files quite likely because they rely on `browser` object that is not fully initialised. [0-0] `browser` object has only `capabilities` and some flags like `isMobile`. [0-0] Helper files that use other `browser` commands have to be moved to `before` hook. [0-0] Spec file(s): file:///C:/Users/VSG/Desktop/WebDriverIO/WebDriverIO_Project_1/test/specs/loginpotest.js
@RaghavPal
@RaghavPal Жыл бұрын
Hi, pls check this - stackoverflow.com/questions/63589090/webdriver-io-unable-to-load-spec-files-quite-likely-because-they-rely-on-brow
@Rohit-ez7pf
@Rohit-ez7pf Жыл бұрын
@@RaghavPal it did not fix my issue
@AoseiOK
@AoseiOK 11 ай бұрын
Ready, I could solve it this way. It worked for me. Just in case, make a backup because it will modify the node_modules and wdio.conf.js => Add the commands npm i --save-dev @wdio/cli npx wdio config -y I hope this is useful, regards.
@AoseiOK
@AoseiOK 11 ай бұрын
@@Rohit-ez7pf Ready, I could solve it this way. It worked for me. Just in case, make a backup because it will modify the node_modules and wdio.conf.js => Add the commands npm i --save-dev @wdio/cli npx wdio config -y I hope this is useful, regards.
@Rohit-ez7pf
@Rohit-ez7pf 11 ай бұрын
@@AoseiOK Thank you brother 🤝
WebdriverIO How to Record and Generate Test Scripts
14:51
Automation Step by Step
Рет қаралды 10 М.
Easiest way to Run WebdriverIO Tests from Jenkins
34:25
Automation Step by Step
Рет қаралды 9 М.
WORLD BEST MAGIC SECRETS
00:50
MasomkaMagic
Рет қаралды 54 МЛН
Офицер, я всё объясню
01:00
История одного вокалиста
Рет қаралды 3,7 МЛН
The Joker wanted to stand at the front, but unexpectedly was beaten up by Officer Rabbit
00:12
отомстил?
00:56
История одного вокалиста
Рет қаралды 7 МЛН
Getting Started with WebdriverIO | Complete Tutorial for Beginners Step by Step
56:49
Selenium Cucumber BDD Framework with Java and TestNG - Page Object Model | POM
24:59
SDET Adda For QA Automation
Рет қаралды 9 М.
Do you know this way to Run WebdriverIO tests from Jenkins using GitHub project
17:55
JavaScript | Mocha: Selenium Page Object Model Tutorial
13:17
QA Underground
Рет қаралды 12 М.
Selenium Framework for Beginners 8 | How to implement POM in Selenium Java
17:38
Automation Step by Step
Рет қаралды 83 М.
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 824 М.
Mobile Automation Testing using WebdriverIO
1:29:15
SDET Unicorns by Dilpreet Johal
Рет қаралды 35 М.
WORLD BEST MAGIC SECRETS
00:50
MasomkaMagic
Рет қаралды 54 МЛН