Getting “x” is not a function error in protractor The 2019 Stack Overflow Developer Survey Results Are InProtractor Object [object Object] has no method 'then'Failed: Error while waiting for Protractor to sync with the page: “angular could not be found on the window”Protractor test not running shows 'weird error 8'WebDriverError: unknown error: Chrome failed to start: exited abnormallyProtractor - Getting “Runtime.executionContextCreated has invalid 'context” error when i run ProtractorNoSuchElementError: no such element: Unable to locate element for protractorElement is not clickable at point in protractorBrowser in protractor test closes automaticallyProtractor assert that an element is not visibleError Retrieving substring from larger text source in Protractor
Likelihood that a superbug or lethal virus could come from a landfill
Is an up-to-date browser secure on an out-of-date OS?
The phrase "to the numbers born"?
Falsification in Math vs Science
Correct punctuation for showing a character's confusion
Finding the area between two curves with Integrate
Can we generate random numbers using irrational numbers like π and e?
How do PCB vias affect signal quality?
Is it okay to consider publishing in my first year of PhD?
Does adding complexity mean a more secure cipher?
Can you cast a spell on someone in the Ethereal Plane, if you are on the Material Plane and have the True Seeing spell active?
How can I have a shield and a way of attacking with a ranged weapon at the same time?
Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?
Why isn't the circumferential light around the M87 black hole's event horizon symmetric?
Is it safe to harvest rainwater that fell on solar panels?
What is the motivation for a law requiring 2 parties to consent for recording a conversation
Why doesn't shell automatically fix "useless use of cat"?
How to add class in ko template in magento2
Mathematics of imaging the black hole
Can a flute soloist sit?
How do I free up internal storage if I don't have any apps downloaded?
Geography at the pixel level
Can withdrawing asylum be illegal?
What do I do when my TA workload is more than expected?
Getting “x” is not a function error in protractor
The 2019 Stack Overflow Developer Survey Results Are InProtractor Object [object Object] has no method 'then'Failed: Error while waiting for Protractor to sync with the page: “angular could not be found on the window”Protractor test not running shows 'weird error 8'WebDriverError: unknown error: Chrome failed to start: exited abnormallyProtractor - Getting “Runtime.executionContextCreated has invalid 'context” error when i run ProtractorNoSuchElementError: no such element: Unable to locate element for protractorElement is not clickable at point in protractorBrowser in protractor test closes automaticallyProtractor assert that an element is not visibleError Retrieving substring from larger text source in Protractor
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm facing issue in my protractor code, even though my code is looking fine without any issues. Can any one please help me to find out the issue.
Login Page Code
var action=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Actions.js");
var loginPage=function()
var user=By.id("LoginForm_username");
var pass=By.id("LoginForm_password");
var submit=By.id("login_submit");
var localvar=this;
this.userfield=function(locator)
return element(locator);
this.passfield=function(locator)
return element(locator);
this.loginButton=function(locator)
return element(locator);
this.loginFun=function(username,password)
action.passdata(localvar.userfield(user),username);
action.passdata(localvar.passfield(pass),password);
module.exports=new loginPage();
My Function Library (Actions.js)
var Base=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js");
var PropertiesReader=require("properties-reader");
var properties=PropertiesReader("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Objects.properties");
var spage=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/SurveysPage.js");
var Actions=function()
this.clickOnElement=function(element)
element.click();
this.passdata=function(element,text)
element.sendKeys(text);
module.exports=new Actions();
my base file
var spage=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/SurveysPage.js");
var PropertiesReader=require("properties-reader");
var properties=PropertiesReader("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Objects.properties");
var LoginMod=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/loginPage.js");
var Action=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Actions.js")
var base=function()
var local=this;
this.browserInit=function(url)
browser.ignoreSynchronization=true;
browser.get(url);
browser.manage().window().maximize();
browser.sleep(2000);
beforeAll(function()
local.browserInit("https://***.****.com/site/login");
LoginMod.loginFun("dsfdsf","fdf");
);
module.exports=new base();
My error Log
Message:
Failed: action.passdata is not a function
Stack:
TypeError: action.passdata is not a function
at loginPage.loginFun (/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/loginPage.js:22:17)
at UserContext.<anonymous> (/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js:19:17)
at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:112:25
at new ManagedPromise (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1077:7)
at ControlFlow.promise (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2505:12)
at schedulerExecute (/usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:95:18)
at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:3084:14)
at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:3067:27)
at asyncRun (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2974:25)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:668:7
From: Task: Run beforeAll in control flow
at UserContext.<anonymous> (/usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:94:19)
at Jasmine.execute (/usr/local/lib/node_modules/protractor/node_modules/jasmine/lib/jasmine.js:200:12)
at /usr/local/lib/node_modules/protractor/built/frameworks/jasmine.js:132:15
at Function.promise (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:682:9)
From asynchronous test:
Error
at new base (/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js:17:5)
at Object.<anonymous> (/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js:23:16)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
if you observe the error log, it is stating that "is not function" error even though there is a functions in the js files and i declare the require of the js file and called those functions with var of the js files..
Spec file
var functionlib=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Actions.js");
var PropertiesReader=require("properties-reader");
var properties=PropertiesReader("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Objects.properties");
var surveyPage=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/SurveysPage.js");
var loginpage=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/loginPage.js");
var base=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js");
describe("this is a test method",function()
var title;
it("this is a test move to the dashboard",function()
title=browser.getTitle().then(function(Pagetitle)
return Pagetitle;
);
);
);
Config File
var PropertiesReader=require("properties-reader");
var properties=PropertiesReader("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Objects.properties");
exports.config={
seleniumAddress:"http://localhost:4444/wd/hub",
capabilities:
browserName:properties.get("browser"),
,
params:
username:'mdtutorial01@gmail.com',
password:'test'
,
//suites:
// surveys:['/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/SurveyTest.js']
//,
specs:properties.get("specs")+"SurveyNav.js",
framework:"jasmine"
jasmine protractor
|
show 4 more comments
I'm facing issue in my protractor code, even though my code is looking fine without any issues. Can any one please help me to find out the issue.
Login Page Code
var action=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Actions.js");
var loginPage=function()
var user=By.id("LoginForm_username");
var pass=By.id("LoginForm_password");
var submit=By.id("login_submit");
var localvar=this;
this.userfield=function(locator)
return element(locator);
this.passfield=function(locator)
return element(locator);
this.loginButton=function(locator)
return element(locator);
this.loginFun=function(username,password)
action.passdata(localvar.userfield(user),username);
action.passdata(localvar.passfield(pass),password);
module.exports=new loginPage();
My Function Library (Actions.js)
var Base=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js");
var PropertiesReader=require("properties-reader");
var properties=PropertiesReader("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Objects.properties");
var spage=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/SurveysPage.js");
var Actions=function()
this.clickOnElement=function(element)
element.click();
this.passdata=function(element,text)
element.sendKeys(text);
module.exports=new Actions();
my base file
var spage=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/SurveysPage.js");
var PropertiesReader=require("properties-reader");
var properties=PropertiesReader("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Objects.properties");
var LoginMod=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/loginPage.js");
var Action=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Actions.js")
var base=function()
var local=this;
this.browserInit=function(url)
browser.ignoreSynchronization=true;
browser.get(url);
browser.manage().window().maximize();
browser.sleep(2000);
beforeAll(function()
local.browserInit("https://***.****.com/site/login");
LoginMod.loginFun("dsfdsf","fdf");
);
module.exports=new base();
My error Log
Message:
Failed: action.passdata is not a function
Stack:
TypeError: action.passdata is not a function
at loginPage.loginFun (/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/loginPage.js:22:17)
at UserContext.<anonymous> (/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js:19:17)
at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:112:25
at new ManagedPromise (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1077:7)
at ControlFlow.promise (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2505:12)
at schedulerExecute (/usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:95:18)
at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:3084:14)
at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:3067:27)
at asyncRun (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2974:25)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:668:7
From: Task: Run beforeAll in control flow
at UserContext.<anonymous> (/usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:94:19)
at Jasmine.execute (/usr/local/lib/node_modules/protractor/node_modules/jasmine/lib/jasmine.js:200:12)
at /usr/local/lib/node_modules/protractor/built/frameworks/jasmine.js:132:15
at Function.promise (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:682:9)
From asynchronous test:
Error
at new base (/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js:17:5)
at Object.<anonymous> (/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js:23:16)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
if you observe the error log, it is stating that "is not function" error even though there is a functions in the js files and i declare the require of the js file and called those functions with var of the js files..
Spec file
var functionlib=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Actions.js");
var PropertiesReader=require("properties-reader");
var properties=PropertiesReader("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Objects.properties");
var surveyPage=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/SurveysPage.js");
var loginpage=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/loginPage.js");
var base=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js");
describe("this is a test method",function()
var title;
it("this is a test move to the dashboard",function()
title=browser.getTitle().then(function(Pagetitle)
return Pagetitle;
);
);
);
Config File
var PropertiesReader=require("properties-reader");
var properties=PropertiesReader("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Objects.properties");
exports.config={
seleniumAddress:"http://localhost:4444/wd/hub",
capabilities:
browserName:properties.get("browser"),
,
params:
username:'mdtutorial01@gmail.com',
password:'test'
,
//suites:
// surveys:['/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/SurveyTest.js']
//,
specs:properties.get("specs")+"SurveyNav.js",
framework:"jasmine"
jasmine protractor
well, Base.login is definitely not a function - not sure why the other one isn't
– Jaromanda X
Mar 22 at 5:09
yes, i update the code, but still i'm getting action.passdata is not a function error
– Satish Rongala
Mar 22 at 5:11
you still gettingError at new base
though
– Jaromanda X
Mar 22 at 5:14
Yes, that is what i'm not understanding where is the issue.. if you able to find please help me in this
– Satish Rongala
Mar 22 at 5:16
but it just says "Error", without saying what the error is
– Jaromanda X
Mar 22 at 5:17
|
show 4 more comments
I'm facing issue in my protractor code, even though my code is looking fine without any issues. Can any one please help me to find out the issue.
Login Page Code
var action=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Actions.js");
var loginPage=function()
var user=By.id("LoginForm_username");
var pass=By.id("LoginForm_password");
var submit=By.id("login_submit");
var localvar=this;
this.userfield=function(locator)
return element(locator);
this.passfield=function(locator)
return element(locator);
this.loginButton=function(locator)
return element(locator);
this.loginFun=function(username,password)
action.passdata(localvar.userfield(user),username);
action.passdata(localvar.passfield(pass),password);
module.exports=new loginPage();
My Function Library (Actions.js)
var Base=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js");
var PropertiesReader=require("properties-reader");
var properties=PropertiesReader("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Objects.properties");
var spage=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/SurveysPage.js");
var Actions=function()
this.clickOnElement=function(element)
element.click();
this.passdata=function(element,text)
element.sendKeys(text);
module.exports=new Actions();
my base file
var spage=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/SurveysPage.js");
var PropertiesReader=require("properties-reader");
var properties=PropertiesReader("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Objects.properties");
var LoginMod=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/loginPage.js");
var Action=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Actions.js")
var base=function()
var local=this;
this.browserInit=function(url)
browser.ignoreSynchronization=true;
browser.get(url);
browser.manage().window().maximize();
browser.sleep(2000);
beforeAll(function()
local.browserInit("https://***.****.com/site/login");
LoginMod.loginFun("dsfdsf","fdf");
);
module.exports=new base();
My error Log
Message:
Failed: action.passdata is not a function
Stack:
TypeError: action.passdata is not a function
at loginPage.loginFun (/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/loginPage.js:22:17)
at UserContext.<anonymous> (/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js:19:17)
at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:112:25
at new ManagedPromise (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1077:7)
at ControlFlow.promise (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2505:12)
at schedulerExecute (/usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:95:18)
at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:3084:14)
at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:3067:27)
at asyncRun (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2974:25)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:668:7
From: Task: Run beforeAll in control flow
at UserContext.<anonymous> (/usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:94:19)
at Jasmine.execute (/usr/local/lib/node_modules/protractor/node_modules/jasmine/lib/jasmine.js:200:12)
at /usr/local/lib/node_modules/protractor/built/frameworks/jasmine.js:132:15
at Function.promise (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:682:9)
From asynchronous test:
Error
at new base (/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js:17:5)
at Object.<anonymous> (/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js:23:16)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
if you observe the error log, it is stating that "is not function" error even though there is a functions in the js files and i declare the require of the js file and called those functions with var of the js files..
Spec file
var functionlib=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Actions.js");
var PropertiesReader=require("properties-reader");
var properties=PropertiesReader("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Objects.properties");
var surveyPage=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/SurveysPage.js");
var loginpage=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/loginPage.js");
var base=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js");
describe("this is a test method",function()
var title;
it("this is a test move to the dashboard",function()
title=browser.getTitle().then(function(Pagetitle)
return Pagetitle;
);
);
);
Config File
var PropertiesReader=require("properties-reader");
var properties=PropertiesReader("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Objects.properties");
exports.config={
seleniumAddress:"http://localhost:4444/wd/hub",
capabilities:
browserName:properties.get("browser"),
,
params:
username:'mdtutorial01@gmail.com',
password:'test'
,
//suites:
// surveys:['/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/SurveyTest.js']
//,
specs:properties.get("specs")+"SurveyNav.js",
framework:"jasmine"
jasmine protractor
I'm facing issue in my protractor code, even though my code is looking fine without any issues. Can any one please help me to find out the issue.
Login Page Code
var action=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Actions.js");
var loginPage=function()
var user=By.id("LoginForm_username");
var pass=By.id("LoginForm_password");
var submit=By.id("login_submit");
var localvar=this;
this.userfield=function(locator)
return element(locator);
this.passfield=function(locator)
return element(locator);
this.loginButton=function(locator)
return element(locator);
this.loginFun=function(username,password)
action.passdata(localvar.userfield(user),username);
action.passdata(localvar.passfield(pass),password);
module.exports=new loginPage();
My Function Library (Actions.js)
var Base=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js");
var PropertiesReader=require("properties-reader");
var properties=PropertiesReader("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Objects.properties");
var spage=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/SurveysPage.js");
var Actions=function()
this.clickOnElement=function(element)
element.click();
this.passdata=function(element,text)
element.sendKeys(text);
module.exports=new Actions();
my base file
var spage=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/SurveysPage.js");
var PropertiesReader=require("properties-reader");
var properties=PropertiesReader("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Objects.properties");
var LoginMod=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/loginPage.js");
var Action=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Actions.js")
var base=function()
var local=this;
this.browserInit=function(url)
browser.ignoreSynchronization=true;
browser.get(url);
browser.manage().window().maximize();
browser.sleep(2000);
beforeAll(function()
local.browserInit("https://***.****.com/site/login");
LoginMod.loginFun("dsfdsf","fdf");
);
module.exports=new base();
My error Log
Message:
Failed: action.passdata is not a function
Stack:
TypeError: action.passdata is not a function
at loginPage.loginFun (/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/loginPage.js:22:17)
at UserContext.<anonymous> (/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js:19:17)
at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:112:25
at new ManagedPromise (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1077:7)
at ControlFlow.promise (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2505:12)
at schedulerExecute (/usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:95:18)
at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:3084:14)
at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:3067:27)
at asyncRun (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2974:25)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:668:7
From: Task: Run beforeAll in control flow
at UserContext.<anonymous> (/usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:94:19)
at Jasmine.execute (/usr/local/lib/node_modules/protractor/node_modules/jasmine/lib/jasmine.js:200:12)
at /usr/local/lib/node_modules/protractor/built/frameworks/jasmine.js:132:15
at Function.promise (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:682:9)
From asynchronous test:
Error
at new base (/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js:17:5)
at Object.<anonymous> (/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js:23:16)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
if you observe the error log, it is stating that "is not function" error even though there is a functions in the js files and i declare the require of the js file and called those functions with var of the js files..
Spec file
var functionlib=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Actions.js");
var PropertiesReader=require("properties-reader");
var properties=PropertiesReader("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Objects.properties");
var surveyPage=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/SurveysPage.js");
var loginpage=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/loginPage.js");
var base=require("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Base.js");
describe("this is a test method",function()
var title;
it("this is a test move to the dashboard",function()
title=browser.getTitle().then(function(Pagetitle)
return Pagetitle;
);
);
);
Config File
var PropertiesReader=require("properties-reader");
var properties=PropertiesReader("/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Utilities/Objects.properties");
exports.config={
seleniumAddress:"http://localhost:4444/wd/hub",
capabilities:
browserName:properties.get("browser"),
,
params:
username:'mdtutorial01@gmail.com',
password:'test'
,
//suites:
// surveys:['/Users/satish/eclipse-workspace/Upshot-Protractor/src/main/java/com/upshot/surveys/Pages/SurveyTest.js']
//,
specs:properties.get("specs")+"SurveyNav.js",
framework:"jasmine"
jasmine protractor
jasmine protractor
edited Mar 22 at 6:33
demouser123
1,90842748
1,90842748
asked Mar 22 at 5:03
Satish RongalaSatish Rongala
12
12
well, Base.login is definitely not a function - not sure why the other one isn't
– Jaromanda X
Mar 22 at 5:09
yes, i update the code, but still i'm getting action.passdata is not a function error
– Satish Rongala
Mar 22 at 5:11
you still gettingError at new base
though
– Jaromanda X
Mar 22 at 5:14
Yes, that is what i'm not understanding where is the issue.. if you able to find please help me in this
– Satish Rongala
Mar 22 at 5:16
but it just says "Error", without saying what the error is
– Jaromanda X
Mar 22 at 5:17
|
show 4 more comments
well, Base.login is definitely not a function - not sure why the other one isn't
– Jaromanda X
Mar 22 at 5:09
yes, i update the code, but still i'm getting action.passdata is not a function error
– Satish Rongala
Mar 22 at 5:11
you still gettingError at new base
though
– Jaromanda X
Mar 22 at 5:14
Yes, that is what i'm not understanding where is the issue.. if you able to find please help me in this
– Satish Rongala
Mar 22 at 5:16
but it just says "Error", without saying what the error is
– Jaromanda X
Mar 22 at 5:17
well, Base.login is definitely not a function - not sure why the other one isn't
– Jaromanda X
Mar 22 at 5:09
well, Base.login is definitely not a function - not sure why the other one isn't
– Jaromanda X
Mar 22 at 5:09
yes, i update the code, but still i'm getting action.passdata is not a function error
– Satish Rongala
Mar 22 at 5:11
yes, i update the code, but still i'm getting action.passdata is not a function error
– Satish Rongala
Mar 22 at 5:11
you still getting
Error at new base
though– Jaromanda X
Mar 22 at 5:14
you still getting
Error at new base
though– Jaromanda X
Mar 22 at 5:14
Yes, that is what i'm not understanding where is the issue.. if you able to find please help me in this
– Satish Rongala
Mar 22 at 5:16
Yes, that is what i'm not understanding where is the issue.. if you able to find please help me in this
– Satish Rongala
Mar 22 at 5:16
but it just says "Error", without saying what the error is
– Jaromanda X
Mar 22 at 5:17
but it just says "Error", without saying what the error is
– Jaromanda X
Mar 22 at 5:17
|
show 4 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55293193%2fgetting-x-is-not-a-function-error-in-protractor%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55293193%2fgetting-x-is-not-a-function-error-in-protractor%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
well, Base.login is definitely not a function - not sure why the other one isn't
– Jaromanda X
Mar 22 at 5:09
yes, i update the code, but still i'm getting action.passdata is not a function error
– Satish Rongala
Mar 22 at 5:11
you still getting
Error at new base
though– Jaromanda X
Mar 22 at 5:14
Yes, that is what i'm not understanding where is the issue.. if you able to find please help me in this
– Satish Rongala
Mar 22 at 5:16
but it just says "Error", without saying what the error is
– Jaromanda X
Mar 22 at 5:17