'clickSelector' and 'hoverSelector' attributes are not working for backstopJS

1.6k views Asked by At

I am using Backstopjs with chrome engine. I am able to take screenshot by passing different urls's and using various attributes but when I am trying to click a button before taking screenshots, the click is not working.

The attributes 'clickSelector' and 'hoverSelector' are getting ignored and no action is getting performed.

Please let me know how to use these attributes.

Below is my backstop.json file where i am opening google.com and trying to click on 'I am feeling lucky' before taking screenshot :

``

 {
  "id": "backstop_default",
  "viewports": [
    {
      "label": "iPad",
      "width": 1024,
      "height": 768
    }
  ],
  "onBeforeScript": "chromy/onBefore.js",
  "onReadyScript": "chromy/onReady.js",
  "scenarios": [
    {
      "label": "Google",
      "url": "https://www.google.co.in",
      "referenceUrl": "https://www.google.co.in",
      "readyEvent": "",
      "readySelector": "",
      "delay": 0,
      "hideSelectors": [],
      "clickSelector": "input[name='btnI']",
      "hoverSelector": "input[name='btnI']",
      "removeSelectors": [],
      "postInteractionWait": "",
      "selectors": ["viewport"],
      "selectorExpansion": true,
      "misMatchThreshold" : 0.1,
      "requireSameDimensions": true
    }
  ],
  "paths": {
    "bitmaps_reference": "backstop_data/bitmaps_reference",
    "bitmaps_test": "backstop_data/bitmaps_test",
    "engine_scripts": "backstop_data/engine_scripts",
    "html_report": "backstop_data/html_report",
    "ci_report": "backstop_data/ci_report"
  },
  "report": ["browser"],
  "engine": "chrome",
  "engineFlags": [],
  "engineOptions": {
  "waitTimeout": 120000,
  "chromePath": "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe",
  "chromeFlags": "['--disable-gpu', '--force-device-scale-factor=1']"
},
  "asyncCaptureLimit": 2,
  "asyncCompareLimit": 50,
  "debug": false,
  "debugWindow": true
} 

``

1

There are 1 answers

0
Ryan Badour On

Trying setting "postInteractionWait" to an integer. This indicates how long to wait after BackstopJS clicks or hovers.