SeleniumHQ / selenium-google-code-issue-archive

Archive, please see main selenium repo
https://github.com/seleniumhq/selenium
347 stars 195 forks source link

Chrome webdriver fails to start from TFS build agent. #4817

Open lukeis opened 8 years ago

lukeis commented 8 years ago

Originally reported on Google Code with ID 4817

I made some selenium tests using the chrome webdriver. They all work fine on my machine
and on the machine where i have the problem. I then added the tests to the companies
TFS build agent for nightly tests. The exact same tests work fine for firefox, only
the chrome and ie versions don't work. i have attached a screen shot of the chrome
driver console when the tests start up and for the ie driver as well, and the log created
by chrome driver which gets deleted once i stop the failing test, i also attached one
of the tests. 

the errors seem related to ports not being open but i talked to the administrator of
the machine and he said there are no ports blocked. i made sure i gave admin to both
chromedriver and ie driver and read/write permission to everyone for the folder with
the project.
i ran "netstat -na" and i see nothing listening for the ports specified by the driver
consoles as being used.

What steps will reproduce the problem?
1.Make a simple selenium test for chrome inside the vs 2012 unit test
2.add it to a vs 2012 project
3.add the project and the test to a TFS build agent 
4.run a build on the agent

What is the expected output? 
the browser should start up and navigate to the specified url and check and element

What do you see instead?
a grey screen on the browser

Selenium version:2.26.0
OS:Windows Server 2008 R2
Browser:Chrome
Browser version:23.0.1271.64 m

Reported by Datcu.Bogdan on 2012-11-23 14:19:09


lukeis commented 8 years ago

Reported by barancev on 2012-11-27 21:52:44

lukeis commented 8 years ago
Forgot i did some code refactoring. these are the test implementation files.
I would like to say again that the tests themselves work when run manually. i have
run them manually on both my local machine and the machine where the build agent runs,
several times without problems.

Reported by Datcu.Bogdan on 2012-12-03 10:43:08


lukeis commented 8 years ago
We have similar issue with TFS Build 2012.  Tests seem to run fine when run manually
/ interactively but fail when run as a queued build / non-interactive test run.  We
keep getting NoSuchElementException on popup dialog elements. We are only using IE9(IEDriverServer
2.28.0) and Firefox17. We are using Selenium Web Driver 2.28.0.  

Reported by mathlazo on 2012-12-20 21:53:45

lukeis commented 8 years ago
I am new to VS. I need to test UI with selenium 2.0 VS 2012 ultimate and TFS. Can anyone
please help me to setup. 
Previously I was working Selnium webdriver with java..

Please help

Reported by chamoli1983 on 2013-01-16 05:59:32

lukeis commented 8 years ago
OK this is ABSURD. Managed to get the ie9 tests to work however the chrome ones still
don't.

I figured ok ill go around the problem.

I made a new project which is a simple console app that runs the tests and writes the
results to a txt file. The i make the unit tests in visual studio to read said file
and report results accordingly to TFS. Well it worked fine and dandy when i ran it.
As soon as i put it on the build and started the build agent it fucked up again. same
exact error (greyed out browser window with the webdriver reporting various errors
all related to how chrome starts up [checked them all on google]).

What the hell did you guys do? did you purposely make it incompatible with TFS? 

Reported by Datcu.Bogdan on 2013-01-16 16:29:35

lukeis commented 8 years ago
After analyzing the issue, I came across the problem of compatibility mode https://productforums.google.com/forum/?fromgroups=#!topic/chrome/dr9yXGwU1Kc.
If you go to Chrome.exe on the server and set "Run this program in compatibility mode
for:" as "Windows XP" and run it manually it does not work like as WebDriver. Maybe
there is some startup parameter of chrome driver without compatibility mode?  

Reported by DuninAlexey on 2013-01-17 12:09:06

lukeis commented 8 years ago
Also if to set the compatibility mode in VS2012 and run the test, then the problem is
reproduced. It seems that the need to mess about with the build agent

Reported by DuninAlexey on 2013-01-17 13:30:27

lukeis commented 8 years ago
@DuninAlexey: Thanks for investigation! If one can write down a short explanation "how
to configure Chrome to run on a TFS agent" we'd add this to the documentation.

Reported by barancev on 2013-01-21 08:03:51

lukeis commented 8 years ago
Hello. Just wanted to update that after lots of hard work i figured out how to get the
chrome tests to work through our TFS agent. Will post another comment with complete
details so you can add it to the documentation.

Reported by Datcu.Bogdan on 2013-01-21 08:51:32

lukeis commented 8 years ago
Any chance you can add that comment you mentioned on 21/1?

Reported by farnsy on 2013-02-08 05:54:38

lukeis commented 8 years ago
Oh sorry completely slipped my mind. It's been busy at work.

Here is what i did to get selenium tests to work in a TFS agent

1)make a visual studio unit test project
2)write the selenium test inside the unit test file created with the project inside
the tests method
3)make sure to add the no sandbox flag when starting up the chrome driver
4)make sure the TFS agent is running in interactive mode and not as a service
5)make sure to install chrome on the account that the agent uses

this should work. the main culprit was the no sandbox mode flag which even now i am
not sure what it does.    

Reported by Datcu.Bogdan on 2013-02-08 12:39:18

lukeis commented 8 years ago
Thanks, it works for me!  

Reported by DuninAlexey on 2013-02-14 09:11:40

lukeis commented 8 years ago

Reported by barancev on 2013-10-19 10:17:26

lukeis commented 8 years ago
Hello All, 
Similar behavour happened at TS online with build agent as service.

To fix this , I used https://msdn.microsoft.com/en-us/Library/vs/alm/Build/agents/windows
as guide to deploy own agent for interactive run. After that Chrome driver started
to work just fine.

Reported by serghei.radov on 2015-08-26 19:41:56

lukeis commented 8 years ago

Reported by luke.semerau on 2015-09-17 17:45:10