Protractor + chrome driver: Element is not clickable at point

前端 未结 14 619
悲&欢浪女
悲&欢浪女 2020-12-14 00:20

Hi I am having some trouble getting a basic protractor test to work.

My setup:

  • I use requirejs so I init angular using angular.bootstr
14条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-14 01:10

    You can define the desired screen resolution through your protractor configuration file (e.g. protractor.conf.js or config.js) for consistent test behavior.

    For example with Chrome browser:

    exports.config = {
      specs: [
        // ...
      ],
      capabilities: {
        browserName: 'chrome',
        chromeOptions: {
          args: [
            '--window-size=1600,900',
            '--headless'
          ]
        }
      }
      // ...
    }
    

    Explanations

    • window-size argument will launch Chrome with a 1600 by 900 window.
    • headless will launch headless Chrome, allowing you to have your tests run with the specified window size (1600 by 900) even if your screen resolution is lower than that.

    You may want to have two configurations, one for developers (without headless mode) who always have a high resolution screen and one for build servers (headless mode) where screen resolution is sometimes a mystery and could be lower than what your application / test is designed for. Protractor configuration file are javascript and can be extended to avoid code duplication.

提交回复
热议问题