Reputation: 5272
I have hard time getting the protractor to run tests in Firefox
Following is a sample test case. It can be tested in Chrome - but fails in Firefox and IE browsers.
<html>
<head>
<title>automation test</title>
<style>
#tst{
width: 200px;
height: 200px;
border: 1px solid;
}
</style>
</head>
<body>
<div id="tst"></div>
<button id="clickme">Click me</button>
<script>
document.getElementById('clickme').addEventListener('click', function(e){
document.getElementById('tst').style.backgroundColor = 'red';
});
</script>
</body>
</html>
describe('sample test', function(){
it('change bgColor to red when click the button', function(){
browser.driver.get("http://localhost/test/index.html");
var btn = browser.driver.findElement(by.id('clickme'));
var clRed = "rgba(255, 0, 0, 1)";
btn.click();
expect(browser.driver.findElement(by.id('tst')).getCssValue('background-color')).toEqual(clRed);
});
});
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['indexspecs.js'],
jasmineNodeOpts: {
showColors: true
},
capabilities: {
// 'browserName': 'internet explorer'
'browserName': 'firefox'
}
};
protractor version - 2.0.0
Firefox version - 45
IE version - 11
When set to Firefox, the browser launches - but not getting the url to run the test.
Upvotes: 4
Views: 819
Reputation: 3645
Your question is too generic to pinpoint the rootcause. But I will try to answer all common issues that might have caused your problem
Update to new version of Protractor (use npm update protractor
) - you are using 2.0.0 which is pretty old (protractor --version
to check it after update). I am using 3.3.0. There is even more latest version - Protractor
I just tried your spec and its all working fine with FF-45
Coming to IE, I am not sure if you have the IE driver already, if not run the below command
webdriver-manager update --ie
Your script might fail in IE as it will throw a warning that 'Active X methods would be blocked' and may be you have to set the ignore option in IE settings before you run
Upvotes: 1
Reputation: 35
You can try to start a standalone Selenium Server locally. You can look at here;
https://github.com/angular/protractor/blob/master/docs/referenceConf.js
Your config file should be like this;
exports.config = {
seleniumServerJar: 'node_modules/protractor/selenium/selenium-server...',
specs: ['indexspecs.js'],
jasmineNodeOpts: {
showColors: true
defaultTimeoutInterval:30000
},
capabilities: {
//'browserName': 'internet explorer'
'browserName': 'firefox'
}
};
You can download jar file from here
http://www.seleniumhq.org/download/
Upvotes: 0