I'm using Protractor in Webstorm and in order to use parameters in the terminal I can do protractor --params.url=http://www.google.com/
Is there a way to specify params in this configuration so I don't have to type it every time? In a similar way to the screen below
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Protractor run configuration doesn't currently support passing command line options to protractor, please vote for WEB-25165 to be notified on any progress with this feature.
However, just as @tehbeardedone has mentioned, params
can be specified in protractor config - see How can I use command line arguments in Angularjs Protractor?
回答2:
Here is the configuration that worked for me
- Open WebStorm
- Click ‘Run’ tab
- Select ‘Edit Configurations…’
- Click ‘+’ button on the top left corner of the newly opened window
- Select ‘Node.js’ configuration from the list
Set parameters (following examples were used on windows machine)
- Name: ‘Protractor’
- Node interpreter: ‘C:\Program Files\nodejs\node.exe’
- Node parameters: ‘’
- Working directory:
- JavaScript file: ‘~\AppData\Roaming\npm\node_modules\protractor\built\cli.js’
- Application parameters, this is where you specify path to your conf, relatively to working directory^ and then parameters like this: ‘e2e/settings/configs/protractor.custom.conf.js --baseUrl="https://stage.mysite.com" --params.login="testuser" --params.password="test_USER00"’
- Environment variables: ‘’
This config works great in my project, where we solely rely on async/await syntax