I have create a sample script, but it can't open chrome browser, so confusing about this issue, i stuck in 7 days, i was try a lot of solution in github or stackoverflow but i cant help so much
Here is my file
package.json
{
"name": "api_test",
"version": "1.0.0",
"main": "index.js",
"directories": {
"test": "wdio"
},
"dependencies": {
"selenium-webdriver": "^4.0.0-alpha.1"
},
"devDependencies": {
"@types/node": "^10.12.18",
"@types/webdriverio": "^5.0.0",
"wdio-mocha-framework": "^0.6.4",
"wdio-selenium-standalone-service": "0.0.12",
"webdriverio": "^5.4.7"
},
"scripts": {
"test": "mocha"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}
test.conf.js
exports.config = {
specs: ['./test/openPage.js'],
hots: 'localhost',
port: 9515,
path: '/',
capabilities: [
{
browserName: 'chrome'
}
],
framework: 'mocha',
mochaOpts:{
ui: 'bdd',
timeout: 600000
},
logLevel: 'verybose',
}
openPage.js
describe('api command', function(){
it('open page', function (){
browser.url('https://www.google.com');
browser.pause(600000);
});
});
When i run: npm test test.conf.js
-> 0 passing (5ms) -> no open chrome no error
When i run: npm test ./test/openPage.js
api command
1) open page
0 passing (15ms)
1 failing
1) api command
open page:
ReferenceError: browser is not defined
at Context.<anonymous> (test\openPage.js:3:9)
npm ERR! Test failed. See above for more details.
I really need help with this, thank you for any infomations
You are mixing webdriverio v5 with non compatible plugins (v4). This is not an issue with webdriverio.