I am attempting to click on an element in the following manner, but I keep encountering an error message that says:
Failed: Cannot read property 'click' of undefined
Here is the code snippet causing the issue:
'use strict;'
var PresentPage = function(){
let PresentPageTitle = element(by.xpath("//*[@id='planAndDev']/div/div/div/div/matanot/form/div[2]/h4"));
let UserPhone = element(by.id("tel"));
let Email = element(by.id("email"));
var AresForPresents = element(by.xpath("//*[@id='verticalRadioGrp']/div/select")).all(by.tagName("option")).then(function(options)
{
return options;
});
this.SelectAreaToGetPresent = function()
{
AresForPresents[3].click();
};
};
module.exports = new PresentPage();
EDIT: It works fine when used inside a function.
this.SelectAreaToGetPresent = function()
{
element(by.xpath("//*[@id='verticalRadioGrp']/div/select")).all(by.tagName("option")).then(function(options)
{
options[3].click();
});