001    /**
002     *  Licensed to the Apache Software Foundation (ASF) under one
003     *  or more contributor license agreements.  See the NOTICE file
004     *  distributed with this work for additional information
005     *  regarding copyright ownership.  The ASF licenses this file
006     *  to you under the Apache License, Version 2.0 (the
007     *  "License"); you may not use this file except in compliance
008     *  with the License.  You may obtain a copy of the License at
009     *
010     *    http://www.apache.org/licenses/LICENSE-2.0
011     *
012     *  Unless required by applicable law or agreed to in writing,
013     *  software distributed under the License is distributed on an
014     *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     *  KIND, either express or implied.  See the License for the
016     *  specific language governing permissions and limitations
017     *  under the License.
018     */
019    
020    package org.apache.geronimo.testsupport;
021    
022    import com.thoughtworks.selenium.Selenium;
023    import com.thoughtworks.selenium.DefaultSelenium;
024    
025    import org.openqa.selenium.server.SeleniumServer;
026    
027    /**
028     * Provides custom extentions to Selenium.
029     *
030     * @version $Rev: 514087 $ $Date: 2007-03-03 01:13:40 -0500 (Sat, 03 Mar 2007) $
031     */
032    public class ExtendedSelenium
033        extends DefaultSelenium
034    {
035        public ExtendedSelenium(final String serverHost, final int serverPort, final String browserStartCommand, final String browserURL) {
036            super(serverHost, serverPort, browserStartCommand, browserURL);
037        }
038        
039        /**
040         * Remove a cookie from the browser.
041         *
042         * <p>
043         * This requires some custom hooks in <tt>user-extensions.js</tt>.  
044         * When using the <tt>selenium-maven-plugin</tt> the defaults should be merged
045         * into the <tt>user-extensions.js</tt> which is loaded by the server.
046         * </p>
047         */
048        public void removeCookie(final String name, final String path) {
049            this.getEval("selenium.removeCookie('" + name + "', '" + path + "')");
050        }
051    }