I have an issue which description matches perfectly with I am not able to identify elements using protractor in angular 2 application but for me the problem is not fixed by adding # before the id value
Here is the code below:
When('I select my input box', (callback) => {
let inputbox = element(by.css('#roomWidthInput'));
console.log('inputBox promise set');
var scrpt = "return document.getElementById('roomWidthInput');";
browser.executeScript(scrpt).then(function (text) {
console.log('info', 'Script is: ' + scrpt);
});
inputbox.isPresent().then(function(isElementVisible) {
console.log('hello!');
expect(isElementVisible).to.be.true;
callback();
});
});
The console logs:
- inputBox promise set
- info Script is: return document.getElementById('roomWidthInput');
and then it throws Error: function timed out after 5000 milliseconds.
I have also tried using by.id
locator with exactly the same results.
Any help would be much appreciated, thanks.