|
40 | 40 | import java.util.logging.Logger; |
41 | 41 | import org.openqa.selenium.Capabilities; |
42 | 42 | import org.openqa.selenium.ImmutableCapabilities; |
| 43 | +import org.openqa.selenium.MutableCapabilities; |
43 | 44 | import org.openqa.selenium.SessionNotCreatedException; |
44 | 45 | import org.openqa.selenium.WebDriverException; |
45 | 46 | import org.openqa.selenium.grid.data.CreateSessionRequest; |
|
49 | 50 | import org.openqa.selenium.internal.Debug; |
50 | 51 | import org.openqa.selenium.internal.Either; |
51 | 52 | import org.openqa.selenium.internal.Require; |
| 53 | +import org.openqa.selenium.remote.CapabilityType; |
52 | 54 | import org.openqa.selenium.remote.Command; |
53 | 55 | import org.openqa.selenium.remote.Dialect; |
54 | 56 | import org.openqa.selenium.remote.DriverCommand; |
@@ -146,7 +148,16 @@ public Either<WebDriverException, ActiveSession> apply(CreateSessionRequest sess |
146 | 148 | new SessionNotCreatedException( |
147 | 149 | "New session request capabilities do not " + "match the stereotype.")); |
148 | 150 | } |
149 | | - capabilities = capabilities.merge(stereotype); |
| 151 | + |
| 152 | + // remove browserName capability if 'appium:app' is present as it breaks appium tests when app |
| 153 | + // is provided |
| 154 | + // they are mutually exclusive |
| 155 | + MutableCapabilities filteredStereotype = new MutableCapabilities(stereotype); |
| 156 | + if (capabilities.getCapability("appium:app") != null) { |
| 157 | + filteredStereotype.setCapability(CapabilityType.BROWSER_NAME, (String) null); |
| 158 | + } |
| 159 | + |
| 160 | + capabilities = capabilities.merge(filteredStereotype); |
150 | 161 | LOG.info("Starting session for " + capabilities); |
151 | 162 |
|
152 | 163 | try (Span span = tracer.getCurrentContext().createSpan("relay_session_factory.apply")) { |
|
0 commit comments