Is it possible to specify params in Protractor Deb

2020-04-20 06:45发布

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 enter image description here

2条回答
叼着烟拽天下
2楼-- · 2020-04-20 07:25

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

查看更多
ら.Afraid
3楼-- · 2020-04-20 07:41

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?

查看更多
登录 后发表回答