Hikaryu Hikaryu - 4 months ago 29x
Javascript Question

Protractor test works on Firefox but fails on Chrome

While i am using protractor with firefox (ubuntu) 46 all my test are green but when i use chrome some of them fails becouse command

doesn't work properly. I was trying to use :

var elm = element(by.sth)
browser.executeScript("arguments[0].scrollIntoView();", elm.getWebElement());


scrollIntoView : function(){ arguments[0].scrollIntoView(); }

but they didn't work aswell.

And my second question is, when i try to start the same test on Windows they all fail becouse of missing locators etc. is it becouse of archtecture differences of browseres or my tests aren't writen well.


I resolved problem. Problem was with promises, We must treat browser.executeScript('window.scroll(0,600);') as a promise so if the test is too fast ,it fails. Solution is using :

    return this;

It also fix problem with missing locators, becouse the have time to load on windows.