Search code examples
protractoraws-device-farm

AWS Device Farm: Protractor scripts are running on local machine instead of AWS cloud machines


https://docs.aws.amazon.com/devicefarm/latest/testgrid/testing-frameworks-nodejs.html

After following above link, I am trying to run Protractor scripts on Device Farm, however scripts are getting executed on my local machine instead of being executed on AWS Cloud machines (i.e. browser instance is opening on my personal laptop). Please advise what changes I need to do to make it run on cloud virtual machine?

Below is my conf.js code:

exports.config = {
  specs: ['ABC.js'],
  hostname: "testgrid-devicefarm.us-west-2.amazonws.com",        
  port: 443,    
  path: "xyz../wd/hub",
  protocol: "https"  }

Below is the output:

Selenium standalone server started at http://xxx.yyy.x.y:xxxxx/wd/hub
    Started
    1 spec, 0 failures
    Finished in 6.941 seconds
    [21:17:42] I/local - Shutting down selenium standalone server.
    [21:17:42] I/launcher - 0 instance(s) of WebDriver still running
    [21:17:42] I/launcher - firefox #01 passed

(Note: I was able to run Selenium scripts successfully on Device Farm. Only issue I am facing is with Protractor)


Solution

  • NOTE: Let me preface this by saying that Protractor v5 and v7 does not support the W3C specification / Selenium 4, and thus cannot be used on AWS Device Farm (see the Github issues [1] and [2]) as the AWS service requires it.


    To connect to a remote address using the URL AWS Device Farm provides, the seleniumAddress parameter can be used in the conf.js.

    Here's an example of a config on Protractor v6

    exports.config = {
        framework: 'jasmine',
        seleniumAddress: <Your Remote URL>,
        specs: ['spec.js'],
        capabilities: {
            browserName: 'firefox'
        }
    }