<commit_before><commit_msg>FrancoisReynaud: adding a disabled test showing issue1586.<commit_after>package org.openqa.grid.e2e.misc;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.grid.e2e.utils.GridConfigurationMock;
import org.openqa.grid.internal.Registry;
import org.openqa.grid.selenium.SelfRegisteringRemote;
import org.openqa.grid.web.Hub;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.net.PortProber;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

// see http://code.google.com/p/selenium/issues/detail?id=1586
public class Issue1586 {

	private Hub hub = Hub.getNewInstanceForTest(PortProber.findFreePort(), Registry.getNewInstanceForTestOnly());
	private URL hubURL = hub.getUrl();

	@BeforeClass(alwaysRun = true)
	public void prepare() throws Exception {

		hub.start();
		hubURL = new URL("http://" + hub.getHost() + ":" + hub.getPort());
		SelfRegisteringRemote remote = SelfRegisteringRemote.create(GridConfigurationMock.webdriverConfig(hub.getRegistrationURL()));
		remote.addFirefoxSupport();
		remote.launchRemoteServer();
		remote.registerToHub();

	}

	@Test(enabled=false)
	public void test() throws MalformedURLException, InterruptedException {
		DesiredCapabilities ff = DesiredCapabilities.firefox();
		WebDriver driver = new RemoteWebDriver(new URL(hubURL + "/grid/driver"), ff);
		for (int i = 0; i < 20; i++) {
			driver.get("http://code.google.com/p/selenium/");
			WebElement keywordInput = driver.findElement(By.name("q"));
			keywordInput.clear();
			keywordInput.sendKeys("test");
			WebElement submitButton = driver.findElement(By.name("projectsearch"));
			submitButton.click();
			driver.getCurrentUrl(); // fails here
		}
		driver.quit();

	}

	@AfterClass(alwaysRun = true)
	public void stop() throws Exception {
		hub.stop();
	}
}
{'fraction_non_alphanumeric': 0.13182037662964752, 'fraction_numerical': 0.008208594881699663, 'mean_word_length': 5.556962025316456, 'pattern_counts': {'":': 1, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1368332', 'n_tokens_mistral': 705, 'n_tokens_neox': 647, 'n_words': 117}