WebDriverIO - Installation & Setup - Part -2
Vložit
- čas přidán 23. 08. 2024
- #webdriverio #nodejs #javascript #automation
In this video, I have explained how to install WebDriverIO and setup WebDriverIO project in Visual Studio Code.
What is WebdriverIO?
WebdriverIO is a custom implementation for selenium's W3C webdriver API. It is written in Javascript and packaged into 'npm' and runs on Node.js.
Webdriver IO Installation:
1. Java
2. Node.js installation
3. NPM installation
4. open terminal/command line:
node -v
npm -v
4. install VSC editor
5. webdriver setup and installation commands:
-- npm init
-- npm install webdriverio --save-dev
-- npm install @wdio/cli
-- ./node_modules/.bin/wdio config
-- npm install chai --save-dev
-- npm install chai-webdriverio --save-dev
-- npm install local-runner --save-dev
~~~Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
www.youtube.co...
Follow me on my Facebook Page:
/ naveenqtpexpert
Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:
t.me/joinchat/...
Paid courses (Recorded) videos:
Java & Selenium Course: www.naveenautom...
API Course: www.naveenautom...
Thanks Naveen, Using WDIO for a long time, recently started with Typescript. Just saw a proper tutorial by you. Great.
Very good info for basic learners, Thank you for your help. One thing I would like to add is If this is a test only repo, then we can only distribute dependencies not devDependencies. The dev dependencies is required while developing only, not while executing.
Thanks Naveen ... you are doing such an awesome piece of help to all automation lovers :)
Thank you so much naveen. This is really a great session ✌👌
Very good , thanks Naveen
Awesome , i like this training and way of explaining
Thanks.. such complex thing in so simple way
Hey Naveen, Its amazing video. I really liked it super simple. Looking for more videos like this. One quick question:- Do you have any video to integrate with saucelabs as well?
husssh!! finally I installed. thanks naveen
Hi Naveen Sir,
Thanks a lot!!!
Great Video for training. One question I have I am using webdriverIO with mocha Javascript using for mobile automation I wanted to priortize my test cases to run in the priority kindly help me out with What is the command to priortize the test cases.
Thanks,
Ajeet
Hey Naveen,
Thanks for the great content!
I think we might need some changes here...
My current dependencies look like this
"devDependencies": {
"@rpii/wdio-html-reporter": "^6.3.2",
"@wdio/allure-reporter": "^7.5.3",
"@wdio/crossbrowsertesting-service": "^5.10.0",
"@wdio/local-runner": "^7.5.4",
"@wdio/mocha-framework": "^7.5.3",
"@wdio/selenium-standalone-service": "^7.5.3",
"@wdio/spec-reporter": "^7.5.3",
"chai": "^4.3.4",
"chai-webdriverio": "^1.0.0",
"chromedriver": "^90.0.0",
"local-runner": "*",
"wdio-chromedriver-service": "^7.0.0",
"wdio-docker-service": "^3.1.2",
"webdriverio": "^7.5.3"
},
Observations:
1. I had a compatibility issue with chai and chai-webdriverio and had to use --force for installation
2. I also had difficulty when adding services to the setup ... was not allowed to select both chromedriver and selenium-standalone driver.
3. I had to --force install local-runner and notice the version is set to "*" -- I don't know what this means
Please help me out if you see this!
I wanted to keep it short. If there are more logs needed, please let me know.
Hi5 to the great content again!
Hi Naveen,
I have one query. Let's say, if I'm setting up the wdio config file for a native mobile project, should I be selecting "Appium " instead of selenium-standalone as a service?
Hi Naveen,
pls upload more videos on webdriverio ASAP..
and also upload the topics on reporting and what is the replica of testng here and how we can group and giving priority and order of execution of test cases as like in Testng..
Thanks Naveen for detailed guidelines, plz share something on webdriverio + appium integration script creation
Yes, looking forward for webdriverio + appium integration
Hi Naveen, why are we installing all the modules as Dev-dependencies?
Thank you so much Naveen.
I missed to run save command, it's daily making to run all the commands. Hope it will solve my issue.👍
Hi Naveen I am using Cucumber as part of my project requirement. Please may i ask if I have to use any before test commands for test execution. Thanks
Thanks Naveen.
While adding configuration in wdio config file for BeforeTest(), I could see you have autocomplete for const chai , global.expect etc.. However I didn't get. Had to type manually.
I was wondering did I miss anything?
Instead of Mocha, If Cucumber is used, should we write this under
before:function?
Hi Naveen, you have selected Mocha test here. What we need to update in wdio.config when using cucumber?
This is really helpful. But am stuck while using npm install since behind the firewall.
Could you please let me know how do I change proxy settings .
We have our own repository to download all artifatcs .. please help here 🙏
Hi Naveen, how to bypass your connection is not private error on chrome through Webdriver IO javascript automation
so every time we make a new project we have to do all these steps?
Hey Naveen. Past three days I'm Searching for screenshot comparison using webdriverio. Not even one useful video is there on CZcams. I think this is the good time to come up with a video. Awaiting for the video. Really important to me. Thanks
Hi Ramya, Screenshot comparison is not a selenium or WebDriverIO job. You need to use some third part tool or library for the image comparison. If you use Selenium/Webdriver with Javascript, there are some libraries to compare screenshots:
Resemble.JS => Compare two images and find the difference. Resemble.js can be used for any image analysis and comparison requirement you might have in the browser.
TemplateMatching.JS => Image search: Find another image (e. g. a button) inside a bigger image (e. g. a screenshot)
@@naveenautomationlabs
Thanks Naveen. Thanks for the quick response. Will try it out and get back to you very soon. Thanks again
Hi Naveen, can i refer these videos to automate angular js application using webdriverIO
HI Naveen I think the webdriverio has been updated so can you make the new video for the new setup as we can see the documents of webdriverio it's different now
How to upload files in webdriverio and in my case we are not having input tag , after clicking on browser link window explorer will open so need to select files from window explorer dialogue box
Hi Naveen will you be doing more vedios on Taiko as well
Naveen - Chai 4.3.7 is installed. In webdriverio it shows the chai version as 4.0.1. How to resolve the conflict
Hi.. all of a sudden am getting error in my working suite... 'error at TLSSocket.onConnectSecure (node:_tls_wrap:1530:34)'
I tried with a new setup as well ... deleting and reinstalling nodejs but nothing helps. Kindly let me know what could be possible reasons for this
Hi Naveen, I am getting error after installing local runner. its compatibility issue but not sure how to fix it.
Can you please explain difference between jasmine and mocha frameworks in one video.
Thanks
Thanks a ton Naveen!! Great video!! but a question I selected cucumber as framework(that is my project requirement). u selected Mocha and u were writing before function before running a test. what do we have do if we are using cucumber framework. i dont see a beforetest for cucumber. please let us know. it will be great help.
kavita can u tell me which is more demanding right now protector or cypress or webdriver io
Does it always need JAVA installed on machine or there is an alternative
Hi naveen,
How to Automate the download and cancel using webdriverio and how we can assert the downloaded file name.
@Naveen I am getting below error
ERROR @wdio/runner: BrowserslistError: Unknown browser query `basedir=$(dirname "$(echo "$0" | sed -e 's`. Maybe you are using old Browserslist or made typo in query.
Hey Naveen while I am trying to add global dependencies I am getting errors
Can you please help me ?
can you please do a video on appium set-up with webdriverio
Please help me!
This error is showing
@wdio/local-runner: Failed launching test session: Error: Couldn't find plugin "html" reporter, neither as wdio scoped package "@wdio/html-reporter" nor as community package "wdio-html-reporter". Please make sure you have it installed!
Hi Team ,
After installating
-- npm init
-- npm install webdriverio --save-dev
I am not able to find the below path in my system
ie.,
PS C:\webdriverioLearning
ode_modules\.bin> cd ./node_modules/.bin/wdio config
cd ./node_modules/.bin/wdio config
Set-Location : A positional parameter cannot be found that accepts argument 'config'.
At line:1 char:1
+ cd ./node_modules/.bin/wdio config
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-Location], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
Even I get the same issue
Did you resolved the issue
pls upload videos on WebDriverIO-native app automation
Naveen thank you so much. This is really helpful. But I am getting this error and so I am going with standalone and not the chromedriver. Is that okay? wdio-chromedriver-service cannot work together with @wdio/selenium-sta
ndalone-service
@wdio/selenium-standalone-service already includes chromedriver
Please uncheck one of them.
even i got this error so i unchecked on of them
Done With the setup
Hello @Naveen, Thanks for making this video. I tried settings up the basic set-up explained in video, however I got stuck at this command post setting-up the wdio/cli - *"./node_modules/.bin/wdio config"*. I tried setting up the things from beginning on another system but result was same.
Upon doing some more research found something on this link (webdriver.io/docs/clioptions.html), running another command "npx wdio config" will do the same job of setting up the file "wdio.config.js".
*Question*- want to check if the above command of "npx wdio config" will do the same job as *"./node_modules/.bin/wdio config"* OR will it create some problem later on?
Error logs-
ode_modules\.bin\wdio.ps1 cannot be loaded
because running scripts is disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ ./node_modules/.bin/wdio config
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
Hi Arvind,
Please try this.
On Search menu search for : PowerShell
Right Click on it> Run As Administrator
once PowerShell is opened, type the following command
Get-ExecutionPolicy (You should see it as "Restricted")
Now, Type the command:
Set-ExecutionPolicy remotesigned (Hit enter)
After completion again check the: Get-ExecutionPolicy (you should see remoteSigned)
Hope this helps.
Thanks!
If it is window then you have to use "\" instead of "/"
@@sourabhtiwari186it worked I don't had to make any changes... Above solution was working. Thanks for the response.
@@suhasramchandra thanks for the input. With the new release of webdriverioIO 6 things have become much more easy.
npx wdio config works
Hi, thanks for the video series. I am new to webdriverio and am following your videos, those are quite informative & interesting.
Now, i am having two issues:
1) when I am trying to add the config file using ./node_modules/.bin/wdio config command, it is showing "found 5 high severity vulnerabilities" and after that whatever command I am using to install chai & chai-webdriverio etc. it is showing the same number of vulnerabilities, and after local-runner installation it shows "found 14 high severity vulnerabilities".
npm audit fix is not resolving the vulnerabilities. Can you please suggest how to resolve?
2) I continued with the installation with the vulnerabilities above, and now when I am trying to run the test using npm run test, it is showing the below error:
interaction with webelement
enter value in a field:
ReferenceError: browser is not defined
Please help me in resolving these issue.
True, while I was proceeding with the installation i noticed about 5 vulnerabilities and I stopped the installation and I am trying to solve the issue but with no luck, and i am wondering if you did solve it.
try issuing 'npm audit fix' command
How to launch browser for each and every example
Thanks Naveen for the Video, at 14:16 , you are selecting chromedriver and selenium-standalone services together ,But when I am trying to do the same I get below error --
wdio-chromedriver-service cannot work together with @wdio/selenium-standalone-service
@wdio/selenium-standalone-service already includes chromedriver
Please uncheck one of them.
I too got the same suggestion and i have unselected selenium standalone and proceeded further
Hi @@cyrilgeorge870, i am also facing same issue. Ignoring the selenium standalone will not cause any issue during course.
Hi Naveen
Thanks for the detail installation
While executing this command I have got the following error
./node_modules/.bin/wdio config
'.' is not recognized as an internal or external command,
operable program or batch file.
npx wdio config
me too. i also tried npx wdio config but it seems it points to the do '.'
this is the error = > > Error: Package exports for 'D:\workfolder
ode_modules\uuid' do not define a valid '.' target
at resolveExportsTarget (internal/modules/cjs/loader.js:460:13)
at resolveExports (internal/modules/cjs/loader.js:393:16)
at Function.Module._findPath (internal/modules/cjs/loader.js:492:20)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:787:27)
at Function.Module._load (internal/modules/cjs/loader.js:693:27)
at Module.require (internal/modules/cjs/loader.js:864:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (D:\forjobtest
ode_modules\devtools\build\index.js:18:13)
at Module._compile (internal/modules/cjs/loader.js:971:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1011:10)
(node:1296) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1296) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
i just found the solution it is in my node js version and nvm which I have not installed. so I used the recommended node js version after installing nvm
I run this command it comes this error.Please help me how to resolve this.
./node_modules/.bin/wdio
you have to add new bash terminal with + button and chang to them
Hey How to open the Webdriver IO after closing it
node_modules/.bin/wdio config I cannot make this work naveen
I observed the below error when selecting chrome driver and selenium standalone server ..
wdio-chromedriver-service cannot work together with @wdio/selenium-standalone-service @wdio/selenium-standalone-service already includes chromedriver Please uncheck one of them.
Can you please help
Remove chrome driver service while setting up. It will work fine.
Unable to add both chromedriver and selenium standlone server in wdio configuration. Here is the error message:
wdio-chromedriver-service cannot work together with @wdio/selenium-standalone-service @wdio/selenium-standalone-service already includes chromedriver
Hi Vignesh, i am also facing same issue. Kindly let me know how did u proceed.
@@gurumahadev5702 Hi Guru i dint fix this problem. instead i'm just using chromedriver alone for now.
I have run wdio config, it successfully installed, but it not showing in workspace. Please help
I have same problem
Whether the following command needs to be appended with "--save-dev"
npm install @wdio/cli. Why it is specifically added to the dependencies and not into dev dependencies
Basically dev dependencies are meant to tell npm that these are only for development purpose , basically it should not be applicable when the application goes to production. This is mostly relatable for developers , for testing I do not think it matters , unless you push your test code to Production which gets consumed by others as client.
@@avishekbehera Then can we use the mentioned commands in the description without appending the --save-dev Since we use it for Automation purpose?
Guys any one pls tell me whether node js will run in Internet explorer browser.
i want to know how to configure ie driver in webdriverio can u please help me
Can u put one video how to configure ie driver naveen pls reply
for edge driver is not working
Hi Naveen , when I install : npm install @wido/cli then I'm getting E404 Error not found the latest . Please advice me . Thanks
I guess that is because of typo in your command, it should be @wdio
Where tf is part 1