-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting Canopy to work with Selenium Hub locally #433
Comments
Asking questions here is totally fine. I have never used Selenium Hub before, I can try to set it up and see if I can get it working. If you are trying to get tests running on multiple machines I can tell you how I have done it in the past if you are interested? |
We have a selenium server that we use this other F# canopy project on that works but all it does is just scan a search page and do some various searches. To get it to work we used phantom JS and used this where we would normally have "start chrome":
I was told to use Chrome Headless so I upgrdaed the project to 1.5.1 and "start ChromeHeadless" works great on my machine, but I try this code on my local selenium hub and it doesn't work. As a possible alternative to selenium, our build gives us a message saying if upgrade to VS 15 with update 1 the server can do multiple unit tests at once, but we have VS 15 with update 3... so not sure why its giving us that notice and not just doing it. If by multiple machines you mean multiple instances of chrome headless each running a unit test I am very interested in that. That is the objective we are trying to achieve with Selenium. Right now they run one at a time and take 13 minutes or so total. |
To troubleshoot your chrome problem, make sure that the chromedriver and chrome versions deployed on your selenium service are in sync. You can see what version of chromedriver you need to support your version of chrome here: https://sites.google.com/a/chromium.org/chromedriver/downloads Each chrome driver version is good for about 3-6 months before needing to update to latest because it just stops working properly. To run things in parallel there are a few options. I just release canopy 2.x that has native support for writing your tests slightly differently, but running them in parallel (with a unit testing framework that supports it like nunit or expecto) With 1.x you can run them in parallel by launching your console application multiple times. What build server are you using? Jenkins/TeamCity/TFS? With Jenkins I setup multiple build agents and setup a build task that was a meta task, that would run sub tasks. You can parameterize your tests and run just a subset of them, and Jenkins will run them in parallel across multiple agents, take the results, and roll them up into the meta build task. All your agent needs to do is simply get latest on your test code and build it and run the .exe. Hope this helps. If you run in parallel it will remove the need for your Selenium Hub, you just run the selenium code directly on the build agent. It does require you to periodically update chrome etc on each agent. |
To confirm it wasn't a chrome issue I tried to change it to
I did run into the issue with the chrome driver being out of date and did upgrade the selenium.WebDriver.ChromeDriver was up to date. The only annoyance I get now is sometimes chromediver.exe stays in the processes and when I clean and rebuild I need to go in and manually stop the processes. We use TFS for our builds. Also, I was curious to upgrade to Canopy 2.0 to see if that worked and I get the following error when I try to install it from NuGet.
I have have cleared my builds and I even removed System.Drawing.Common from my References and tried again. I am on Framework 4.6.1 and using F# 4.1.0.2, if that helps. |
@shellwe Sorry I have not been able to look into this and will be traveling for the new two weeks. Are you still have this issue? |
No worries, we got it to work to some degree, it has a strange issue where it can't find an element and so it fails, then I rerun the test a moment later and it passes. We are working through that now. Regarding Canopy not being able to upgrade to 2. I have not tried again since I had the issue. I didn't want to risk introducing more problems. Right now we wrap a ranAlready around our canopy runner so it doesn't keep running things over and over while NUnit tries to do its thing. |
You need to specify browserName instead of browser |
@lefthandedgoat are you able to tell us how you achieved this ? i.e. get tests running on multiple machines |
@manishdube I used Jenkins and then had a plugin that would run multiple build definitions at the same time across different agents and merge the results. I would setup builds for testing screen 1, screen 2, screen 3, etc and then they would all kick off and finish when the last one was done and the overall build/run would pass/fail based on the summation of the sub builds. |
Fascinating. ! |
@manishdube Its been five years since I have done it, but I used a plugin I found on Jenkin's website. You defined a job and its purpose was to run other jobs. It handled starting them and merging the overall results, it did not merge the artifacts produced by canopy, just how many tests passed/failed. |
Thanks. |
This is not an issue with how Canopy needing to be fixed. It is an issue with me not knowing what I am doing and also not knowing where to post questions about canopy other than here. I apologize for the length, I just want to get more info out there
I upgraded to version 1.5.1 of canopy (the minimum version to get chrome headless to work). For some reason I get errors when upgrading to 1.6 and I don't know enough about F# to debug it.
I have a unit test in F# canopy that works great when I have "start chrome" as well as when I have "start ChromeHeadless", but when I use this code to have it work in selenium hub:
it kicks off this in my selenium hub command prompt:
and then nothing happens that I can see in the grid.
In case I did something wrong when setting up the grid the two commands I used were:
java -jar selenium-server-standalone.jar -role hub
in one browser and this in another
I can go to the grid console and see the browser icons like I am supposed to, so I assume its set up right.
I get the following error with my unit test in Visual Studio.
The text was updated successfully, but these errors were encountered: