Fix bug when specifying customGeckoDriverPath#222
Merged
christian-bromann merged 1 commit intowebdriverio-community:mainfrom Sep 11, 2023
marcogrcr:main
Merged
Fix bug when specifying customGeckoDriverPath#222christian-bromann merged 1 commit intowebdriverio-community:mainfrom marcogrcr:main
christian-bromann merged 1 commit intowebdriverio-community:mainfrom
marcogrcr:main
Conversation
marcogrcr
commented
Sep 10, 2023
| await waitPort({ port }) | ||
| const browser = await remote({ | ||
| automationProtocol: 'webdriver', | ||
| hostname: '0.0.0.0', |
Contributor
Author
There was a problem hiding this comment.
Note that this is no longer necessary as the default value has changed from localhost to 0.0.0.0. See: webdriverio/webdriverio@c6d81b5#diff-b5fe71260eef292213595160b7583dabd5475f9775eee92b92d00d0c5fb1fa7f
marcogrcr
commented
Sep 10, 2023
| const browser = await remote({ | ||
| automationProtocol: 'webdriver', | ||
| hostname: '0.0.0.0', | ||
| port, // must set port or wdio will automatically start geckodriver |
Contributor
Author
There was a problem hiding this comment.
8 tasks
christian-bromann
approved these changes
Sep 11, 2023
Contributor
christian-bromann
left a comment
There was a problem hiding this comment.
Excellent PR 👌 nice work!
Contributor
|
Can we update the branch? |
WHAT?
Destructured `customGeckoDriverPath` out of `params` in
`function start()`.
Additionally, updated `test.e2e.js` to test the three `webdriver` usage
modes: 1/ automatically download and start, 2/ automatically start, 3/
manually start.
Finally, added a self-referencing `devDependency` to `geckodriver`
since `webdriverio` transitively depends on it.
WHY?
Before this change, running the following code:
```ts
import { start } from 'geckodriver'
await start({ customGeckoDriverPath: '/some/path/geckodriver' })
```
Would fail to start the `geckodriver` because it would execute:
```shell
geckodriver --custom-gecko-driver-path=/some/path/geckodriver --port=43083 --host=0.0.0.0 --websocket-port=0
```
Which results in exit code `64` and the following output:
```log
/some/path/geckodriver: error: Found argument '--custom-gecko-driver-path' which wasn't expected, or isn't valid in this context
If you tried to supply `--custom-gecko-driver-path` as a value rather than a flag, use `-- --custom-gecko-driver-path`
USAGE:
geckodriver [OPTIONS]
For more information try --help
```
By destructuring `customGeckoDriverPath`, the extraneous
`--custom-gecko-driver-path` argument is no longer specified and the
webdriver starts successfully.
HOW?
Successfully ran:
```shell
npm run build && npm test
```
Contributor
Author
Done! |
Contributor
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHAT?
Destructured
customGeckoDriverPathout ofparamsinfunction start().Additionally, updated
test.e2e.jsto test the threewebdriverusage modes: 1/ automatically download and start, 2/ automatically start, 3/ manually start.Finally, added a self-referencing
devDependencytogeckodriversincewebdriveriotransitively depends on it.WHY?
Before this change, running the following code:
Would fail to start the
geckodriverbecause it would execute:Which results in exit code
64and the following output:By destructuring
customGeckoDriverPath, the extraneous--custom-gecko-driver-pathargument is no longer specified and the webdriver starts successfully.HOW?
Successfully ran: