angelozerr/angularjs-eclipse

Unable to run protractor test case from eclipse

Closed this issue · 49 comments

Hi All,

I am new to Protractor.I am not sure, if this is the right place to discuss Protractor issue. Please direct me to the right group if this is not the right place for this discussion.

I am unable to run protractor test case from eclipse.
I am able to see Protractor option in my eclipse (Run as> Protractor) but when I run, nothing happens.

Please find the steps followed by me.
Pre requisite I used

  1. Eclipse MARS 4.5
  2. Node.js version V4.4.3 LTS installed
  3. Installed Protractor globally using npm
  4. Installed webdriver-manager update.

Steps followed to run to create project:

  1. Created a new project (Static web project)
  2. Go to Help>Install New software
  3. Copy the url : http://oss.opensagres.fr/angularjs-eclipse/1.1.0/.
  4. Select all and Click on Finish.
  5. Right click on the Project and Hover over to Configure and click on "Convert to AngularJS project"
  6. configure cli.js in eclipse.
    image
  7. Made sure Protractor is check in Project> Properties (Right on new Project created>Properties> Javascript>Tern>Modules>Protractor is checked)
    image
    8.Create two .js file (conf.js and to-do.js)
    conf.js class
    exports.config = {
    //seleniumAddress: 'http://localhost:4444/wd/hub',
    directConnect: true,
    specs: ['to-do.js']
    };

to-do.js Class
describe('angularjs homepage todo list', function() {
it('should add a todo', function() {
browser.get('https://angularjs.org');

element(by.model('todoList.todoText')).sendKeys('write first protractor test');
element(by.css('[value="add"]')).click();

var todoList = element.all(by.repeater('todo in todoList.todos'));
expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write first protractor test');

// You wrote your first test, cross it off the list
todoList.get(2).element(by.css('input')).click();
var completedAmount = element.all(by.css('.done-true'));
expect(completedAmount.count()).toEqual(2);

});
});

  1. Open command prompt and run webdriver-manager start
  2. right click on conf.js in eclipse and run as>Protractor
    image

Result:
No action. Console remain blank.

Please help. Any help is appreciated.

Please share your project.

Hi angelozerr,

Thank you for the quick reply. The issue is resolved.
I had missed additional configuration in eclipse.
I had not configured Protractor in eclipse "Run configuration".

Sharing the details below for anyone facing the same issue.

  1. Click on run configuration
    image
  2. Configure Protractor in "Run configuration" and click on Run:
    Browse workspace to select cli.js (For me cli.js path: Current Project>node_modules>Protractor>built>cli.js)
    image

Hi can you please guide to develop protractor framework .

Hi kasidkhansbp can you please guide to develop protractor framework .

Hi Utkarsh,

Are you facing any issue?
A good start would be to read Protractor doc.
http://www.protractortest.org/#/

Thanks and Regards,
Md Kasid Khan

Hi Kasid,

Thank you for your quick reply.
I installed protractor also configured it with eclipse.
Now i want to develop a complete Automation framework using page object or any other for my angular application.
So i am looking for an approach or any base framework.
I am looking forward your suggestion.

Thanks,
Utkarsh

Hi Utkarsh,

I assumed you have worked on automation framework.

You can look into the below tutorials and check out udemy or udacity, if any of the courses satisfy your need.

such as:
https://www.packtpub.com/books/content/behavior-driven-development-selenium-webdriver
https://www.udemy.com/cucumber-tutorials/
http://toolsqa.com/selenium-webdriver/page-object-model/

Thanks and Regards,
Md Kasid Khan

eclipse
Hi kasidkhansbp,

Thanks for your question and answer.. I used your question and answer as a guide and i am also able to execute protractor from eclipse successfully. However there is one concern.. If a writing scripts in the eclipse IDE, lets say i am typing elements(by.) ..., at the moment i place the dot the console is not opening up for suggestion. I need to press control+spacebar everytime manually to get the suggestion.

Kindly help me what i have been missed.

Hi @
untitled
https://github.com/angelozerr, https://github.com/santhosh12992
After following all your above mentioned steps, still protractor is not visible in my preference window. Can you please help with some more detailed step.

What I mean to say is

  • I was using Selenium WebDriver for automation
  • I have started learning Protractor
  • I have successfully installed node.js, Protractor globally,
  • Created a Config.js and spec.js through notepad++
  • updated webDriver and started it
  • protractor cnfig.js makes my program run
  • Now i want to configure it on Eclipse so that i can write and debug code easily
  • Consider me as basic user and please provide each step from installing plugins , where to write code and now how run it through protractor

There are only some materials available for this content and that too in a discrete manner. Many user have been posting questions through out that are still unanswered. This would help user get all stuffs at a same place without providing links

Refer to screen shot above

Thanks and Regards

Hai, I am new to protractor.
Could you pls explain what is cli.js. and how to configure it in eclipse

Hi,
while ran protractor in eclipse i got error H:/protractor/test/node modules/protractor/built/logger.js:75
info(...msg)

Kindly help me what i have been missed.

Thanks & Regards

Hi,
I am new to protractor
tool need to install to run protractor in visual studio 2012
could you help me how to run the protractor code in visual studio 2012.

Thanka in advance

Hi,
I am learning protractor, and configured protractor in my eclipse mars. When i am executing my test with protractor it throws an error :
/***********************************************/
D:\MyTestWorkspce\ProtractorT\node_modules\protractor\built\logger.js:75
info(...msgs) {
^^^

SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object. (D:\MyTestWorkspce\ProtractorT\node_modules\protractor\built\configParser.js:5:18)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)

I could not able to move forward due to this error. Kindly help me to resolve this issue.
Thanks in advance.
protractor error

protractor it throws an error :
/***********************************************/
D:\MyTestWorkspce\ProtractorT\node_modules\protractor\built\logger.js:75
info(...msgs) {
^^^

I think it's a problem with the embed node.js version which is now old. Please try to install last version of node.js and after fill the preferences AngularJS/Protractor nodepath field with your installed nodejs pasth.

Thank you @angelozerr. Issue is resolved now. Thanks for your quick response.

Thanks & Regards

@DivasPandey could you share how you did it. I experience the same problem and I can' t get rid off it.
I've got the newest version on node.js installed which is v6.9.5.

Now, when I go to Window -> Preferences ->AngularJS -> Protractor I have something like this:
2017-02-09_23h47_28

When it comes to 'Run/Debug protractor with' I can't choose any path outside of my 'Protractor' project.
When it comes to 'Node.js install' like you see it's old v4.2.4 but when I change it on native Node.js and then indicate path on v6.9.5 (C:\Program Files\nodejs\node_modules\npm\cli.js) then nothing change at all and still get the same error :(

Could you please explain me what exactly should I change to make it working in eclipse?

Thamk you in advance

@angelozerr could you please refer to the post above?
Thank you

@chudyed to be honnest with you, I'm very busy with angular2-eclipse and it's hard for me to find time to fix problem with protractor. I want to support protractor for angular2-eclipse, when I will do that I will study the problem with angularjs eclipse.

@chudyed - Sorry for the delay.
My node version is - v6.9.4
Protractor version is - Version 5.0.0
The only difference I am seeing in your configuration and my configuration is - Path mentioned in "Node.js install" section. Try to configure your run with "Native Node.js" option and in path select the location where your node.exe has installed.
protractor run config

hi ,

My Node Version is 6.9.5
npm Version is 3.10.10
Protractor --version is 5.1.1

I'm still facing the below issue...
can some one help me in this
Error:
c:\Users.....\logger.js:75
info(...msgs) {
^^^

SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object. (C:\Users.....\node_modules\protractor\built\configParser.js:5:18)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)

@chudyed @sigudd
Hi All,
I am new to protractor and was facing the same issue. It was solved by doing some hit and trial.
So, I am giving the steps:-
#Run the script and you will get error.
#Click on Debug (inline with the "Console" tab)
#Right Click on the error and click “Edit Protractor for_XXX_conf.js.
#Change the location of the nodejs which you have installed.
I have attached the screenshot. I hope it help.

Protractor_Help.docx

Please share your inputs if it helped. Thanks to all the other who are trying to help and special thanks to @angelozerr who has posted the answer which gave me a direction.

Thanks,
Sunny

@Sunny-Teo
Hi,
thanks for your response - > your advice is really usefull and in my case this is step into the right direction but I still have got to problems/questions

  1. do you know hot to set the location once for all? What I mean is that I do everything like you said but I have to change this location every time I want to run conf.js
  2. after I set a new location of node.js like you said and run conf.js a get an error:
[23:15:38] I/launcher - Running 1 instances of WebDriver
[23:15:38] I/direct - Using ChromeDriver directly...
[23:15:38] E/direct - Error code: 135
[23:15:38] E/direct - Error message: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.
[23:15:38] E/direct - Error: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.

Unfortunatelly webdriver-manager update doesn't help at all in my case - do you maybe struggled with something like this?

@Sunny-Teo
Thanks, for your help. it worked for me. but I need to do the settings ( which you mentioned) every time I run.... is there any permanent solution... please let me know incase you find out.

I need to do the settings ( which you mentioned) every time I run

I tell me if it's not a problem with Oomph? Try to uncheck the given preference:

image

Hi @sigudd @chudyed ,
I have check the above post by @angelozerr after I have made my hand dirty with doing something which i dont know exactly. In my preference, above checkboxes are not selected.

What I have done?

  1. Copy the latest nodejs exe
  2. Navigate to the following path
    C:\Users\XXXXXX.p2\pool\plugins\tern.eclipse.ide.server.nodejs.embed.win32.win32.x86_64_1.2.0.201606160856\node-v4.2.4-win32-x86_64
  3. Rename the original exe as a backup
  4. Paste the latest nodejs exe
  5. Now the name is same but exe is latest

I am by far not a developer so no idea but as a wild guess it is a problem with the tern plugin embed nodejs.

@chudyed
after I set a new location of node.js like you said and run conf.js a get an error:
Sunny@ I am expecting that you are able to run protractor through cmd prompt.
Try to run the webdriver-manager update.
If it does not solve the problem, then check the browser version of chrome and see if it the latest as I have see some post related to latest browser issue.
Then, no idea....I will try to reproduce this first and will keep doing my hit and trial.

Do let me know if it help.

@Sunny-Teo
This replacing node.js's works :) It's pretty smart workaround - I didn't come up with it :)
When it comes to my second problem: 'webdriver-manager update' doesn't help. Maybe there is something wrong with Protractor 5.1.1 itself, I don't know :(
@angelozerr
I use STS and I can not see anything like Oomph in my IDE

@chudyed
Following versions are there on my machine:-
npm v3.10.10
node v6.9.5
protractor v5.1.1
Eclipse vMars

This is just for information and may be it help you to rule out something.

I have tried on:
npm v3.10.10
node v6.9.5 then v6.10.0
protractor v5.1.1
STS 3.3.0 and 3.8.3(Eclipse Neon 2 v4.6.2)
Windows 8.1 Enterprice

Everything works in window console but there is a problem with IDE :( (I am a step forward ;))

@angelozerr I am not able to chose the node js version.Can u pls help me out as i have been stuck on this issue for past 1 week.This is not a permanent solution because we have to set the node js path again and again while running the test.Anyone can provide me the permanent solution for the this problem
/home/smart/workspace/DemoProtractor/node_modules/protractor/built/logger.js:75
info(...msgs) {
^^^

SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object. (/home/smart/workspace/DemoProtractor/node_modules/protractor/built/configParser.js:5:18)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)

@anjalisingh824
Please check the below post if it helps to solve your issue.
Sunny-Teo commented on Feb 23

Hi,

To any one face this issues

image

image

Please any one to assist on this.

Thanks,
Srinivasan

@sdseenu : can you please be more specific like which version of protractor you are using and which eclipse you are using etc

Hi Aarya91,

Am try to run protractor using Eclipse Java EE IDE & Version: Neon Release (4.6.0)
See below connection.

image

But i tried could not it run. Can you help me!!!

I had some issues in integrating latest version of protractor. When I downgraded the version it worked. Can you please try downgrading the version

Hi All,

I am also facing the issue while running the "protractor script" using eclipse .

Below is my error.
C:\Users\agudla\eclipse-workspace\ProtractorSampleProject\node_modules\protractor\built\logger.js:76
info(...msgs) {
^^^

SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object. (C:\Users\agudla\eclipse-workspace\ProtractorSampleProject\node_modules\protractor\built\configParser.js:6:18)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)

Can you please suggest me , how to solve this issue .

I am using below versions for running my code
1.Node. js --- v6.11.3
2.Protractor --- version 5.1.2

@Vasundhara-vasu
#Run the script and you will get error.
#Click on Debug (inline with the "Console" tab)
#Right Click on the error and click “Edit Protractor for_XXX_conf.js.
#Change the location of the nodejs which you have installed.
Please check my comment above for the snapshot in a word doc. I hope it will help.
Let us know if it solves the problem.

@Sunny-Teo
Thanks for your reply . i tried with the steps you provided in the comment . issue solved , the script is now running in eclipse.

and ever time i am runing my new script , i am getting the same error so is there any option to save the above setting ( as you mentioned in the comment )

Hi All,

I'm trying to install protractor using cmd with command npm install -g protractor , but getting some kind of network error .

image

Can anyone help me to resolve this issue , It seems to be a proxy error on my machine (I've also tried changing proxies but same error is still there).

Need help!!

@RohitVerma0123

No need to navigate to the nodejs folder , run the "npm install -g protractor" command in "C:\Program Files" location

Hello, I am able to run protractor conf.js from my command prompt but when i try to run it in eclipse(mars) I am facing the following issues. Please help
1.

I cant see protractor in eclipse run configuration.
2. I am getting error: protractor: command not found
screen shot 2017-11-23 at 9 18 23 pm
screen shot 2017-11-23 at 9 19 13 pm

Solution:
I found the solution: Just try the following commands from the terminal to clean your eclipse space.

cd /Applications/Eclipse.app
ls -ltr
cd Contents/MacOS/
./eclipse -clean

Now it should work. :)

@MadhuKiranGitHub
Hi I have the same issue,Have you got solution for "protractor: command not found".

@Pbujji : No still facing the same issue.
But I followed a different approach and now I am able to execute.
Please follow link--> https://www.youtube.com/watch?v=8dZ3isYcthI
Hope this helps :)

@Vasundhara-vasu
Please check my Feb 23 comment for the below:-

"ever time i am runing my new script , i am getting the same error so is there any option to save the above setting ( as you mentioned in the comment )"
There I have provided a workaround for this.
Let me know if it helped.

Hi,
I am learning protractor, and configured protractor in my eclipse mars. When i am executing my test with protractor it throws an error :
/***********************************************/
D:\MyTestWorkspce\ProtractorT\node_modules\protractor\built\logger.js:75
info(...msgs) {
^^^

SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object. (D:\MyTestWorkspce\ProtractorT\node_modules\protractor\built\configParser.js:5:18)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)

I could not able to move forward due to this error. Kindly help me to resolve this issue.
Thanks in advance.
protractor error

Hi ,
I am also facing the same issue, which version nodejs solved your issue?

@rajeswari463
I just gave up with Eclipse and started to work with VSCode - just give it a try, should work.

Below link explains clearly on how to install required plugins to eclipse and configure protractor:
http://selftechy.com/2019/12/08/setting-up-protractor-with-latest-eclipse-windows-plugins-settings

@rajeswari463
I just gave up with Eclipse and started to work with VSCode - just give it a try, should work.

I think even I thought of doing that as I had downloaded latest eclipse version. All the plugins and configurations mentioned above (also in stackoverflow) are related to previous version of the eclipse and the plugins. Below is the link which explains how to configure protractor with latest eclipse and its plugins:
http://selftechy.com/2019/12/08/setting-up-protractor-with-latest-eclipse-windows-plugins-settings