1

I followed this SO post to set up my Gruntfile. If I manually downloaded Selenium standalone and specified its location in the file, my test runs successfully. Since I would like to automate this process, I tried the following configuration:

protractor_webdriver: {
  start: {
    options: {
      path: 'node_modules/grunt-protractor-runner/node_modules/protractor/bin/',
      command: 'webdriver-manager start'
    }
  }
};

grunt.loadNpmTasks('grunt-protractor-webdriver');
grunt.registerTask('test', ['protractor_webdriver:start','protractor:run'])

Is there a way to avoid downloading manually? I tried the above but when I ran it, I got the warning:

Running "protractor_webdriver:start" (protractor_webdriver) task
Verifying property protractor_webdriver.start exists in config...OK
File: [no files]
Options: path="node_modules/grunt-protractor-runner/node_modules/protractor/bin/", command="webdriver-manager start", keepAlive=false
Starting Selenium server
>> Selenium Standalone is not present. Install with webdriver-manager update --standalone

So I still need to download the selenium standalone server manually?
Or maybe I missed some configuration here?

Community
  • 1
  • 1
Celina yang
  • 59
  • 1
  • 10
  • I actually had similar issue and talked about it [here](https://letmedothat.wordpress.com/category/preotractor/) and, I also wrote a bat script to automate the process. – Saifur Jan 13 '15 at 21:11
  • But Webdriver-manager exists in the specified location by path,why a standalone selenium server is needed? – Celina yang Jan 13 '15 at 21:15
  • Webdriver-manager and selenium server is not same. How are you going to execute the tests without starting the selenium server? – Saifur Jan 13 '15 at 21:26
  • I think I understand what you mean. I put the standalone selenium server somewhere and specify its location using option 'seleniumServerJar'. it works now. Thx a lot. – Celina yang Jan 14 '15 at 15:32

2 Answers2

1

Protractor is a wrapper around WebDriverJS.

It's a nodejs program that interacts with Selenium Server and specific Browser drivers (e.g. ChromeDriver, IEDriver).

So, without using selenium server (at least for IE), you cannot run tests written with protractor. Test scripts send commands to the Selenium Server, which in turn then communicates with the browser driver. See this for a description of the architecture.

In a nutshell, without having started a Selenium server instance beforehand, nothing will happen.

Dr1Ku
  • 2,875
  • 3
  • 47
  • 56
Saifur
  • 16,081
  • 6
  • 49
  • 73
  • As mentioned in another answer, one can also use `directConnect` (formerly known as `chromeOnly`) to bypass Selenium. Only works for Firefox and Chrome. With recent versions of protractor (e.g. `2.1.0`) though, Selenium standalone is launched automatically when `directConnect` is `false`. – Dr1Ku Jun 29 '15 at 12:54
  • You are right. With latest version that is possible. Do you know if they have direct connect support for IE yet? – Saifur Jun 29 '15 at 13:00
  • Nope, IE still needs Selenium standalone – https://github.com/angular/protractor/blob/master/docs/referenceConf.js#L67-L70 – Dr1Ku Jun 29 '15 at 14:15
1

You can run Protractor without Selenium by specifying

directConnect: true

in your respective Protractor configuration file (e.g. protractor.conf.js).

Dr1Ku
  • 2,875
  • 3
  • 47
  • 56
NG Ninza
  • 11
  • 2
  • Welcome to StackOverflow. Can you provide some more context to your answer (such as what the option does, and how you specify the option, extra information, etc.)? – Aaron D Mar 14 '15 at 04:36