ok so after a long and painful search trying to find an answer to this question I finally came across the answer trying to answer a different question.
Most of the documentation I found explain that we must use Actions in the form of a WebElement and then cast that to Javascript and pass it a script element in the form of an array with the click action.
Well the same kinds goes here but with a few modifications.
describe('', function() {
var ptor = protractor.getInstance();
var driver = ptor.driver;
it('', function() {
var hiddenElement = driver.findElement(protractor.By.yourchosenlocator(''));
driver.executeScript("arguments[0].click()", hiddenElement).then(function() {
expect(whatever).toMatch(whatever);
});
}, 30000);
});
as you can see there is no use of webelement and no cast required.
Here are the sources that helped me in my search for answers
How do you click on an element which is hidden using Selenium Webdriver?
SELENIUM WEBDRIVER – HOW TO CLICK ON A HIDDEN LINK OR MENU
Selenium WebDriver - hidden select and anchor [duplicate]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…