Protractor + chrome driver: Element is not clickable at point

前端 未结 14 559
悲&欢浪女
悲&欢浪女 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 00:56

    You should set window size in your config file

    onPrepare: function() {
      browser.manage().window().setSize(1600, 1000);
    }
    
    0 讨论(0)
  • 2020-12-14 00:57

    I fix this problem by using browser time sleep.

    browser.driver.sleep(3000)
    

    before giving click button

    0 讨论(0)
  • 2020-12-14 00:59

    From Gal Malgarit's answer,

    You should set window size in your config file

    onPrepare: function() {
      browser.manage().window().setSize(1600, 800);
    }
    

    If it still doesn't work you should scroll to the element's location

    browser.executeScript('window.scrollTo(720, 881);');
    element(by.id('add-stuff-button')).click();
    
    0 讨论(0)
  • 2020-12-14 01:01

    This happens if the chrome window is too small, try to add inside the beforeEach

    browser.driver.manage().window().setSize(1280, 1024);
    
    0 讨论(0)
  • 2020-12-14 01:01

    I had the same error and purely adjusting the screen size did not fix it for me.

    Upon further inspection it looked as though another element was obscuring the button, hence the Selenium test failed because the button was not (and could not be) clicked. Perhaps that's why adjusting the screen size fixes it for some?

    What fixed mine was removing the other element (and later adjusting the positioning of it).

    0 讨论(0)
  • 2020-12-14 01:01

    This works better than specifying the window size, in case you test need to run on multiple displays.

    browser.manage().window().maximize();

    0 讨论(0)
提交回复
热议问题