2

I am trying to run my tests on IE.The problem is that on Firefox it works, but when i try to run it on IE, it opens the browser, navigates to my site, but just after the page finishes to load the following error is returned:

    com.thoughtworks.selenium.SeleniumException: JavaScript error (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 302 milliseconds
Build info: version: '2.21.0', revision: '16552', time: '2012-04-11 19:08:45'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_25'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.internal.seleniumemulation.SeleneseCommand.apply(SeleneseCommand.java:42)
at org.openqa.selenium.internal.seleniumemulation.Timer.run(Timer.java:39)
at org.openqa.selenium.WebDriverCommandProcessor.execute(WebDriverCommandProcessor.java:145)
at org.openqa.selenium.WebDriverCommandProcessor.doCommand(WebDriverCommandProcessor.java:75)
at com.thoughtworks.selenium.DefaultSelenium.focus(DefaultSelenium.java:221)
at com.extjs.selenium.form.TextField.setValue(TextField.java:127)

My code:

public void setUp(String server, String browser) throws Exception {
    WebDriver driver = getWebDriver(InputData.BROWSER);
    selenium = new WebDriverBackedSelenium(driver, server);
}
 public WebDriver getWebDriver(String browser) {
    if (browser.equalsIgnoreCase("*firefox")) {
       return new FirefoxDriver(firefoxProfile);
    } else if (browser.equalsIgnoreCase("*iexplore")) {
        return new InternetExplorerDriver();
    } else if (browser.equalsIgnoreCase("*chrome")) {
        return new ChromeDriver();
    }   else if (browser.equalsIgnoreCase("*htmlunit")) {
        return new HtmlUnitDriver(true);
    }   else  {
        logger.error("Browser not supported");
        return null;
    }
}

Can anyone help me on this one? I am stuck in trying to have it run on IE. I am using the latest drivers that i could download from http://code.google.com/p/selenium/downloads/list

Thanks

vali83
  • 157
  • 1
  • 4
  • 13
  • 1
    Apparently i found the problem, it was selenium.focus(path); instruction that i was using. I am now looking for a way to change this. If anyone has a hint...i would be grateful – vali83 Apr 13 '12 at 11:32
  • Btw, I don't see selenium.focus(path) in your code. Secondly what is String server that is being passed to WebDriverBackedSelenium? – nilesh Apr 14 '12 at 15:48
  • String server -> 'http://www.mysite.com'. String browser -> '*firefox'. I found that the real problem will now be the way i will find a workaround for the selenium.focus(xpath) function which i use in a few places in my framework. It seems that selenium does not perform a correct action for focus, blur, mouseover under IE, so i'll need to figure out how to do that. One workaround will be this:((WebDriverBackedSelenium) selenium).getWrappedDriver().findElement(By.xpath(path)).sendKeys("\n");, but i am not sure that is what i will use in the end. I am still searching for other ways – vali83 Apr 17 '12 at 07:08

0 Answers0