Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.
This repository was archived by the owner on Jun 27, 2019. It is now read-only.

Add selenium-server-standalone jar to pom.xml #127

Open

Description

When I switch laptops or work environments, I always find myself spending a lot of time trying to remember how to configure the executable drivers for Chrome and IE.

I like to use the DefaultWebDriverSupplier especially and do my testing over a grid configuration.

I think it'd be a lot simpler to reference the standalone jar file directly in the pom.xml. This way, when I lug around the framework from site to site, I can just start it up and reference the standalone from a common maven location each and every time to stage my own grid configuration. It makes editing scripts and tests a lot simpler instead of having to configure for specific environments. It's also 1 less item I need to setup.

org.seleniumhq.selenium selenium-server-standalone 2.41.0

Activity

  1. raboof commented on May 18, 2014

    @raboof
    Contributor

    Sounds useful to me, anyone else see a reason not to add this dependency?

  2. amolenaar commented on May 18, 2014

    @amolenaar
    Member

    How does this help with the special drivers required for Chrome and IE?

  3. jguglielmi commented on May 18, 2014

    @jguglielmi
    Author

    Starting up selenium servers from a single location in the .m2 directory
    means it's one less thing to do in addition to moving the driver
    executables. Right now, grid configurations require users to download the
    standalone separately. I just think it'd be nice to have it with the other
    driver jar files packaged in a single location.
    On May 18, 2014 10:48 AM, "Arjan Molenaar" notifications@github.com wrote:

    How does this help with the special drivers required for Chrome and IE?

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/127#issuecomment-43441567
    .

  4. cwortel commented on May 19, 2014

    @cwortel
    Contributor

    Hi guys,

    I think selenium server and the specific drivers are already mavenized, so here it is not going to fix any problem. The only problem I can imagine here is the chromedriver executable (+ie driver), which is not a maven project. It would be cool if it was though, would save a lot of hassle with configuration management. Any ideas why it is not already? Or would there be an alternative way to package these in the project?

    Cirilo


    From: Jaison Guglielmi notifications@github.com
    Sent: 18 May 2014 18:15
    To: xebia/Xebium
    Subject: Re: [Xebium] Add selenium-server-standalone jar to pom.xml (#127)

    Starting up selenium servers from a single location in the .m2 directory
    means it's one less thing to do in addition to moving the driver
    executables. Right now, grid configurations require users to download the
    standalone separately. I just think it'd be nice to have it with the other
    driver jar files packaged in a single location.
    On May 18, 2014 10:48 AM, "Arjan Molenaar" notifications@github.com wrote:

    How does this help with the special drivers required for Chrome and IE?

    Reply to this email directly or view it on GitHubhttps://github.com//issues/127#issuecomment-43441567
    .

    Reply to this email directly or view it on GitHubhttps://github.com//issues/127#issuecomment-43443942.

  5. jguglielmi commented on May 19, 2014

    @jguglielmi
    Author

    Hi Cirilo! Would it be worth anything if Xebium came packaged with the latest selenium-standalone jar file only and maybe consider creating a fixture to launch a hub and/or node configuration? I agree that users should download the driver executables and set them up in the System Properties, but I still find we should have the selenium-server-standalone somewhere with it to launch the grid and hub. I know a lot of people including myself who work in environments with no internet connection, so we have to move the executable drivers and the individual Maven dependencies with them. It's a pain. Centralizing any part of the process makes life easier.

    Maybe put up some documentation or an example of how to use Xebium in a grid configuration? I've got one now I can contribute to the project if you'd like. I found maybe 2 blogs with detailed instructions on it, but I think this is more in the domain of the project examples. I can submit a pull request if you'd like.

  6. cwortel commented on May 19, 2014

    @cwortel
    Contributor

    Hi Jaison,

    Ok, I now get what you're saying. I indeed have faced the problem that it was difficult (if not practically impossible) to get all the dependencies through an enterprise proxy. Which would result in having to copy paste entire maven repos across workstations. I don't see any harm in at least packaging Xebium with all basic dependencies.

    About the documentation, I admit I failed to update it for the last xx months. For now a start would be to update the links-section with stuff like the blogs you mentioned, but it sure needs some work. Any input is welcome.

    Regards,

    Cirilo


    From: Jaison Guglielmi notifications@github.com
    Sent: 19 May 2014 14:02
    To: xebia/Xebium
    Cc: Cirilo Wortel
    Subject: Re: [Xebium] Add selenium-server-standalone jar to pom.xml (#127)

    Hi Cirilo! Would it be worth anything if Xebium came packaged with the latest selenium-standalone jar file only and maybe consider creating a fixture to launch a hub and/or node configuration? I agree that users should download the driver executables and set them up in the System Properties, but I still find we should have the selenium-server-standalone somewhere with it to launch the grid and hub. I know a lot of people including myself who work in environments with no internet connection, so we have to move the executable drivers and the individual Maven dependencies with them. It's a pain. Centralizing any part of the process makes life easier.

    Maybe put up some documentation or an example of how to use Xebium in a grid configuration? I've got one now I can contribute to the project if you'd like. I found maybe 2 blogs with detailed instructions on it, but I think this is more in the domain of the project examples. I can submit a pull request if you'd like.

    Reply to this email directly or view it on GitHubhttps://github.com//issues/127#issuecomment-43493454.

  7. jguglielmi commented on May 19, 2014

    @jguglielmi
    Author

    Hi all!

    So some fun food for thought...I've been working on a generic SeleniumGridFixture.java. I put the standalone-server.jar file in "./FitNesseRoot/files/selenium/standalone/". It works beautifully on Windows. I haven't tried it on Linux, but let me know if this is something that peaks your interests and I'll submit it to the project. Below is a sample test and the code. You'll have to change the URL and the test, but I think you get the idea. 🎱

    package com.xebia.incubator.xebium;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import java.io.IOException;
    public class SeleniumGridFixture {
    public int port = 4444;
    public String host = "localhost";
    public String browserParameters="";
    private static final Logger LOG = LoggerFactory.getLogger(SeleniumGridFixture.class);

    public SeleniumGridFixture(){
        super();
    }
    
    public void setPort(int port){
        this.port=port;
        LOG.info("Port set to:" + port + ".");
    }
    
    public void setBrowserParameters(String browserParameters){
        this.browserParameters=browserParameters;
        LOG.info("Browser parameters set to:" + host + ".");
    }
    
    public boolean startHubUsingJson(String json){
        Runtime run = Runtime.getRuntime();
        try {
            run.exec("java -jar ./FitNesseRoot/files/selenium/standalone/selenium-server-standalone.jar -role hub -hubConfig " + json);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return false;
        }
        return true;
        //java -jar selenium-server-standalone.jar -role hub -hubConfig hubconfig.json
    }
    public boolean startHub(){
        Runtime run = Runtime.getRuntime();
        LOG.info("Hub has been started.");
        try {
            run.exec("java -jar ./FitNesseRoot/files/selenium/standalone/selenium-server-standalone.jar -role hub -port " + port);
            //run.exec("cmd.exe /c start cmd.exe /c java -jar ./FitNesseRoot/files/selenium/standalone/selenium-server-standalone.jar -role hub -port " + port);
        }
        catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return false;
        }
        return true;
    }
    
    public boolean startNodeOnHubUrl(String hubUrl){
        Runtime run = Runtime.getRuntime();
        try {
            //java -jar selenium-server-standalone-2.41.0.jar -role webdriver -hub http://localhost:5554/grid/register -browser browserName="iexplore",version=ANY,platform=WINDOWS,maxInstances=5 -port 5555
            run.exec("java -jar ./FitNesseRoot/files/selenium/standalone/selenium-server-standalone.jar -role webdriver -hub " + hubUrl + " -browser " + browserParameters + " -port " + port);
        }
        catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return false;
        }
        return true;
    }
    

    }

  8. jguglielmi commented on May 19, 2014

    @jguglielmi
    Author

    Sample Test:

    !| script | selenium grid fixture |
    | set port | 5555 |
    | start hub |
    | set port | 5556 |
    | set browser parameters | browserName="iexplore",version=ANY,platform=WINDOWS,maxInstances=5 |
    | start node on hub url | http://localhost:5555/grid/register |
    | set port | 5557 |
    | set browser parameters | browserName="firefox",version=ANY,platform=WINDOWS,maxInstances=5 |
    | start node on hub url | http://localhost:5555/grid/register |
    | set port | 5558 |
    | set browser parameters | browserName="chrome",version=ANY,platform=WINDOWS,maxInstances=5 |
    | start node on hub url | http://localhost:5555/grid/register |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions