1

I'm running Protractor test that clicks on buttons on a page that open new windows with various sites URLs. While Chrome automatically opens these windows as tabs, Firefox and Safari don't automatically do this, and often have popup blockers enabled.

I need these newly opened windows to be tabs within the same browser window instead so I can use getAllWindowHandles to access them later.

How do I set the following settings in an automated fashion using protractor:

Firefox:

  • tabs/Open new windows in a new tab instead to true

  • tabs/Don't load tabs until selected to true

  • tabs/When I open a link in a new tab, switch to it immediately to false

  • Content/block popup windows to false

Safari:

  • tabs/open pages in tabs instead of windows to Always

  • tabs/command-click opens a link in a new tab to true

  • tabs/when a new tab or window opens, make it active to false

  • block popup window to false

Here is my config file right now:

exports.config = {
  seleniumPort: null,
  chromeDriver: './selenium/chromedriver',
  seleniumArgs: [],
 sauceUser: null,
  sauceKey: null,
  seleniumAddress: 'http://localhost:4444/wd/hub',
  allScriptsTimeout: 30000,
  specs: [
    'app/test/e2e/lib/csv_reporter.js',
    'app/test/e2e/lib/rllib.js',
    'app/test/e2e/lib/rlmatchers.js',
    'app/test/e2e/client_specific_config/globals.js',
      'app/test/e2e/client_specific_config/ShopDeals_FreeShipping_Functionality_spec.js',
      'app/test/e2e/client_specific_config/ShopByCategory_ItemCheck_spec.js'
  capabilities: {
   'browserName': 'chrome'
  },
  baseUrl: 'http://test-static.com/widgets/mall/#/Home',
  rootElement: 'html',
  onPrepare: function() {
  },

If this is directly impossible I would appreciate any workarounds, as this single handedly determines whether my tests run. Thanks!

ditkin
  • 11
  • 5
  • Welcome on SO! :) What have you tried yet?? Please look at the [How to ask guide](http://stackoverflow.com/questions/how-to-ask) to improve your question and the future ones. To help you now: you will have to use the `multiCapabilites` option in your config ([documentation](https://github.com/angular/protractor/blob/master/spec/multiConf.js)) and look at [this question](http://stackoverflow.com/questions/22917219/protractor-accessing-capabilities). – glepretre Jul 11 '14 at 07:44
  • Thank you for the edits. I have tried setting the properties I listed in the onPrepare function to 'true' or 'false', but I don't know what to name them – ditkin Jul 11 '14 at 13:54
  • I think you've misunderstood me, could you edit your question to add your protractor config and some of your tests please? I think you should simply write different tests depending on the browser running to achieve what you want. Just add a function that returns the current capability in the `onPrepare` ;) (see the link to the SO question I gave you). – glepretre Jul 11 '14 at 15:14
  • I posted the config file, I can post parts of the tests but the main functionality they exploit is clicking on a href buttons that open links. And, it's up to the browser whether these links open in the same window in a new tab or in a different window, so I don't see a workaround. – ditkin Jul 13 '14 at 04:46

0 Answers0