Skip to content

Commit

Permalink
#529 Cannot find capabilities with browserName=ie when grid hub url s…
Browse files Browse the repository at this point in the history
…pecified in -Dremote

- Set correct correct IE browser name
- Add ability to set ie browser through "internet explorer" string
  • Loading branch information
Boris Osipov committed May 11, 2017
1 parent 8463167 commit a305cbd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/main/java/com/codeborne/selenide/WebDriverRunner.java
Expand Up @@ -14,6 +14,7 @@ public class WebDriverRunner {

public static final String CHROME = "chrome";
public static final String INTERNET_EXPLORER = "ie";
public static final String IE_FULL_NAME = "internet explorer";
public static final String EDGE = "edge";
public static final String FIREFOX = "firefox";
/**
Expand Down Expand Up @@ -175,7 +176,8 @@ public static boolean isChrome() {
* Is Selenide configured to use Internet Explorer browser
*/
public static boolean isIE() {
return INTERNET_EXPLORER.equalsIgnoreCase(browser);
return INTERNET_EXPLORER.equalsIgnoreCase(browser) || IE_FULL_NAME
.equalsIgnoreCase(browser);
}

/**
Expand Down
Expand Up @@ -2,6 +2,7 @@

import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.WebDriverProvider;
import com.codeborne.selenide.WebDriverRunner;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.Proxy;
Expand Down Expand Up @@ -76,7 +77,7 @@ public WebDriver createWebDriver(Proxy proxy) {
protected WebDriver createRemoteDriver(String remote, String browser, Proxy proxy) {
try {
DesiredCapabilities capabilities = createCommonCapabilities(proxy);
capabilities.setBrowserName(browser);
capabilities.setBrowserName(isIE() ? WebDriverRunner.IE_FULL_NAME : browser);
return new RemoteWebDriver(new URL(remote), capabilities);
} catch (MalformedURLException e) {
throw new IllegalArgumentException("Invalid 'remote' parameter: " + remote, e);
Expand Down
@@ -0,0 +1,22 @@
package com.codeborne.selenide.webdriver;

import com.codeborne.selenide.Configuration;
import org.junit.Test;

import static com.codeborne.selenide.WebDriverRunner.isIE;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;

public class InternetExplorerNamesTest {
@Test
public void internetExplorerShortNameTest() {
Configuration.browser = "ie";
assertThat(isIE(), is(true));
}

@Test
public void internetExplorerFullNameTest() {
Configuration.browser = "internet explorer";
assertThat(isIE(), is(true));
}
}

0 comments on commit a305cbd

Please sign in to comment.