When I want to have automated browser function with selenium-webdriver, I write at first with chrome driver and then make it run with phantomjs.
But sometimes the two browsers behave differently and the function fails to run with phantomjs while selenium-webdriver works fine.
Currently, to find out what is wrong I am struggling in command line. I wonder if there is a way to run phantomjs with "head" so that I can see the problem at a glance. Or maybe is there way to make chrome behave exactly like phantomjs?
I'm aware of some web site are restricted to get information by headless server, I'd give up in that case.
Edit:
module.exports = {
init: function () {
browser.ignoreSynchronization = true;
browser.driver.manage().window().setPosition(0, 0);
browser.driver.manage().window().setSize(2000, 1200);
browser.driver.get('https://www.google.com');
browser.waitForAngular();
browser.driver.sleep(2000);
},
login: function (user, company) {
element(by.css('[aria-label="Search"]')).click();
element(by.css('[aria-label="Search"]')).sendKeys('tkc@bn.co');
browser.driver.sleep(1000);
element(by.css('.sbico')).click();
expect(browser.driver.getCurrentUrl()).toContain('https://www.google.com/#q=tkc%40bn.co');}
This code will just visit google, type in the field and click search. Works fine with chrome. Does not pass on phantomjs.