Skip to content

Commit 5cceaa8

Browse files
Set default WebDriver path to / (webdriverio#4907)
* set default path to / * PR feedback * still use /wd/hub for cloud sessions
1 parent 37769e5 commit 5cceaa8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+323
-297
lines changed

docs/ConfigurationFile.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ exports.config = {
2828
//
2929
hostname: 'localhost',
3030
port: 4444,
31-
path: '/wd/hub',
31+
path: '/',
3232
// Protocol: http | https
3333
// protocol: 'http',
3434
//

docs/DriverBinaries.md

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ id: driverbinaries
33
title: Driver Binaries
44
---
55

6-
WebdriverIO allows using driver binaries directly instead of services.
6+
WebdriverIO allows using driver binaries directly instead of services.
77

88
Here’s an example with `geckodriver`.
99

@@ -72,7 +72,7 @@ Start Geckodriver by running:
7272
/path/to/binary/geckodriver --port 4444
7373
```
7474

75-
For example, if you ran the `curl` command from above, you should have a `geckodriver` binary available in the current folder.
75+
For example, if you ran the `curl` command from above, you should have a `geckodriver` binary available in the current folder.
7676

7777
Start it like this:
7878

@@ -84,28 +84,3 @@ Start it like this:
8484
This will start Geckodriver on `localhost:4444` with the WebDriver endpoint set to `/`.
8585

8686
Keep this running in the background and open a new terminal window. Next step is to download WebdriverIO via NPM:
87-
88-
### Configure the `path`
89-
90-
If you are using driver’s binary directly (like `geckodriver` or `chromedriver`), the `path` to it is different from the expected default (which is `/wd/hub`).
91-
92-
To change that, we need to edit the `wdio.conf.js` file.
93-
94-
Add a section to specify the `path`:
95-
96-
```json
97-
path: '/',
98-
```
99-
100-
So the top of your file should look like:
101-
102-
```json
103-
exports.config = {
104-
runner: 'local',
105-
//
106-
// Uncomment line below to override default path ('/wd/hub') for usage of driver binary directly, ex: chromedriver or geckodriver.
107-
path: '/',
108-
}
109-
```
110-
111-
Be sure to save the file after your edits.

docs/GettingStarted.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The `-y` will answer 'yes' to all the prompts, giving you a standard NPM project
2828

2929
### Install WebdriverIO CLI
3030

31-
If you want to use WebdriverIO in your project for integration testing, we recommend using the test runner. It comes with lots of useful features that makes your life easier.
31+
If you want to use WebdriverIO in your project for integration testing, we recommend using the test runner. It comes with lots of useful features that makes your life easier.
3232

3333
Since WebdriverIO version 5, the testrunner is in the [`@wdio/cli`](https://www.npmjs.com/package/@wdio/cli) NPM package.
3434

@@ -40,21 +40,19 @@ npm i --save-dev @wdio/cli
4040

4141
### Generate Configuration File
4242

43-
Next, you’ll generate a configuration file to store your WebdriverIO settings.
43+
Next, you’ll generate a configuration file to store your WebdriverIO settings.
4444

4545
To do that, just run the configuration utility:
4646

4747
```sh
4848
./node_modules/.bin/wdio config -y
4949
```
5050

51-
That's it! The configurator will install all required packages for you and create a config file called `wdio.conf.js`.
52-
53-
As we're using Geckodriver, we need to override the default `path` (which uses the Selenium's default of `/wd/hub`). Then, we'll be ready to create your first <dfn>spec file</dfn> (or “test file”).
51+
That's it! The configurator will install all required packages for you and create a config file called `wdio.conf.js`.
5452

5553
### Create Spec Files
5654

57-
Now it's time to create your test file. You’re going to store all of your test files in a new folder.
55+
Now it's time to create your test file. You’re going to store all of your test files in a new folder.
5856

5957
Create the test folder like this:
6058

@@ -101,7 +99,7 @@ Now save the file and return to your terminal.
10199

102100
### Start the Testrunner
103101

104-
Now, time to run your tests!
102+
Now, time to run your tests!
105103

106104
To do so, just run:
107105

@@ -113,6 +111,6 @@ Hurray! The test should pass, and you can start writing integration tests with W
113111

114112
If you ran into any issues, reach out in our [Gitter Channel](https://gitter.im/webdriverio/webdriverio) and post the error you're seeing, and which of the above steps you’re stuck on.
115113

116-
If you are interested in more in depth video on-boarding tutorials, feel free to check out our very own course called [learn.webdriver.io](https://learn.webdriver.io/?coupon=wdio).
114+
If you are interested in more in depth video on-boarding tutorials, feel free to check out our very own course called [learn.webdriver.io](https://learn.webdriver.io/?coupon=wdio).
117115

118116
Our community has also collected a lot of [boilerplate projects](BoilerplateProjects.md) that may help you to get started.

docs/Options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Default: `4444`
3535
Path to driver server endpoint.
3636

3737
Type: `String`<br>
38-
Default: `/wd/hub`
38+
Default: `/`
3939

4040
### `queryParams`
4141
Query paramaters that are propagated to the driver server.

examples/wdio.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ exports.config = {
1313
//
1414
hostname: 'localhost',
1515
port: 4444,
16-
path: '/wd/hub',
16+
path: '/',
1717
// Protocol: http | https
1818
// protocol: 'http',
1919
//

packages/wdio-cli/src/commands/run.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const cmdArgs = {
2727
},
2828
path: {
2929
type: 'string',
30-
desc: 'path to WebDriver endpoints (default /wd/hub)'
30+
desc: 'path to WebDriver endpoints (default "/")'
3131
},
3232
user: {
3333
alias: 'u',

packages/wdio-cli/src/constants.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ export const QUESTIONNAIRE = [{
167167
}, {
168168
type: 'input',
169169
name: 'path',
170-
message: 'What is the path to your Selenium standalone or grid server?',
171-
default: '/wd/hub',
170+
message: 'What is the path to your browser driver or grid server?',
171+
default: '/',
172172
when: /* istanbul ignore next */ (answers) => answers.backend.indexOf('own Selenium cloud') > -1
173173
}, {
174174
type: 'list',

packages/wdio-cli/src/templates/wdio.conf.tpl.ejs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@ exports.config = {
2424
path: '<%= answers.path %>',<% } else if (answers.services.includes('appium')) { %>
2525
port: 4723,<% }
2626
27-
if(answers.services.includes('chromedriver')) { %>
28-
//
29-
// Override default path ('/wd/hub') for chromedriver service.
30-
path: '/',<% }
31-
32-
if(answers.services.length === 0) { %>
33-
//
34-
// Uncomment line below to override default path ('/wd/hub') for usage of driver binary directly, ex: chromedriver or geckodriver.
35-
// path: '/',<% }
36-
3727
// Protocol: http | https
3828
// protocol: 'http',
3929
if(answers.env_user && answers.env_key) { %>

packages/wdio-config/src/utils.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const DEFAULT_HOSTNAME = '127.0.0.1'
22
const DEFAULT_PORT = 4444
33
const DEFAULT_PROTOCOL = 'http'
4+
const DEFAULT_PATH = '/'
5+
const LEGACY_PATH = '/wd/hub'
46

57
const REGION_MAPPING = {
68
'us': '', // default endpoint
@@ -46,7 +48,7 @@ export function isCucumberFeatureWithLineNumber(spec) {
4648
* helper to detect the Selenium backend according to given capabilities
4749
*/
4850
export function detectBackend (options = {}, isRDC = false) {
49-
let { port, hostname, user, key, protocol, region, headless } = options
51+
let { port, hostname, user, key, protocol, region, headless, path } = options
5052

5153
/**
5254
* browserstack
@@ -56,7 +58,8 @@ export function detectBackend (options = {}, isRDC = false) {
5658
return {
5759
protocol: protocol || 'https',
5860
hostname: hostname || 'hub-cloud.browserstack.com',
59-
port: port || 443
61+
port: port || 443,
62+
path: path || LEGACY_PATH
6063
}
6164
}
6265

@@ -66,9 +69,10 @@ export function detectBackend (options = {}, isRDC = false) {
6669
*/
6770
if (typeof user === 'string' && typeof key === 'string' && key.length === 32) {
6871
return {
69-
protocol: protocol || DEFAULT_PROTOCOL,
72+
protocol: protocol || 'https',
7073
hostname: hostname || 'hub.testingbot.com',
71-
port: port || 80
74+
port: port || 443,
75+
path: path || LEGACY_PATH
7276
}
7377
}
7478

@@ -88,7 +92,8 @@ export function detectBackend (options = {}, isRDC = false) {
8892
return {
8993
protocol: protocol || 'https',
9094
hostname: hostname || getSauceEndpoint(sauceRegion, isRDC),
91-
port: port || 443
95+
port: port || 443,
96+
path: path || LEGACY_PATH
9297
}
9398
}
9499

@@ -115,7 +120,8 @@ export function detectBackend (options = {}, isRDC = false) {
115120
return {
116121
hostname: hostname || DEFAULT_HOSTNAME,
117122
port: port || DEFAULT_PORT,
118-
protocol: protocol || DEFAULT_PROTOCOL
123+
protocol: protocol || DEFAULT_PROTOCOL,
124+
path: path || DEFAULT_PATH
119125
}
120126
}
121127

packages/wdio-config/tests/__mocks__/@wdio/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const validateConfig = jest.fn().mockImplementation(
3030
hostname: 'localhost',
3131
port: 4444,
3232
protocol: 'http',
33-
path: '/wd/hub',
33+
path: '/',
3434
automationProtocol: 'webdriver'
3535
},
3636
config

0 commit comments

Comments
 (0)