-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding microsoft edge browser support to the SeLion client
- Loading branch information
1 parent
d394197
commit e70faaa
Showing
7 changed files
with
131 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...com/paypal/selion/internal/platform/grid/browsercapabilities/EdgeCapabilitiesBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/*-------------------------------------------------------------------------------------------------------------------*\ | ||
| Copyright (C) 2015 PayPal | | ||
| | | ||
| Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance | | ||
| with the License. | | ||
| | | ||
| You may obtain a copy of the License at | | ||
| | | ||
| http://www.apache.org/licenses/LICENSE-2.0 | | ||
| | | ||
| Unless required by applicable law or agreed to in writing, software distributed under the License is distributed | | ||
| on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for | | ||
| the specific language governing permissions and limitations under the License. | | ||
\*-------------------------------------------------------------------------------------------------------------------*/ | ||
|
||
package com.paypal.selion.internal.platform.grid.browsercapabilities; | ||
|
||
import org.apache.commons.lang.StringUtils; | ||
import org.openqa.selenium.remote.CapabilityType; | ||
import org.openqa.selenium.remote.DesiredCapabilities; | ||
|
||
import com.paypal.selion.SeLionConstants; | ||
import com.paypal.selion.configuration.Config; | ||
import com.paypal.selion.configuration.Config.ConfigProperty; | ||
import com.paypal.selion.platform.grid.browsercapabilities.DefaultCapabilitiesBuilder; | ||
|
||
/** | ||
* This class represents the capabilities that are specific to Edge browser. | ||
*/ | ||
class EdgeCapabilitiesBuilder extends DefaultCapabilitiesBuilder { | ||
|
||
@Override | ||
public DesiredCapabilities getCapabilities(DesiredCapabilities capabilities) { | ||
if (isLocalRun() && StringUtils.isNotBlank(getBinaryPath())) { | ||
System.setProperty(SeLionConstants.WEBDRIVER_EDGE_DRIVER_PROPERTY, getBinaryPath()); | ||
} | ||
capabilities.setBrowserName(DesiredCapabilities.edge().getBrowserName()); | ||
if (ProxyHelper.isProxyServerRequired()) { | ||
capabilities.setCapability(CapabilityType.PROXY, ProxyHelper.createProxyObject()); | ||
} | ||
return capabilities; | ||
} | ||
|
||
/* | ||
* Returns the location of edgedriverserver or "" if it can not be determined. | ||
*/ | ||
private String getBinaryPath() { | ||
String location = System.getProperty(SeLionConstants.WEBDRIVER_EDGE_DRIVER_PROPERTY, | ||
Config.getConfigProperty(ConfigProperty.SELENIUM_EDGEDRIVER_PATH)); | ||
return location; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
client/src/test/java/com/paypal/selion/sample/EdgeBrowserTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/*-------------------------------------------------------------------------------------------------------------------*\ | ||
| Copyright (C) 2015 PayPal | | ||
| | | ||
| Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance | | ||
| with the License. | | ||
| | | ||
| You may obtain a copy of the License at | | ||
| | | ||
| http://www.apache.org/licenses/LICENSE-2.0 | | ||
| | | ||
| Unless required by applicable law or agreed to in writing, software distributed under the License is distributed | | ||
| on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for | | ||
| the specific language governing permissions and limitations under the License. | | ||
\*-------------------------------------------------------------------------------------------------------------------*/ | ||
package com.paypal.selion.sample; | ||
|
||
import static org.testng.Assert.assertNotNull; | ||
|
||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.remote.RemoteWebDriver; | ||
import org.testng.annotations.Test; | ||
|
||
import com.paypal.selion.annotations.WebTest; | ||
import com.paypal.selion.platform.grid.Grid; | ||
|
||
/* | ||
* DEVNOTE Tests in this class exist primarily for demonstration purposes and as a basic sanity checks. | ||
*/ | ||
public class EdgeBrowserTest { | ||
|
||
@Test | ||
@WebTest | ||
public void testGoogleOnEdge() { | ||
RemoteWebDriver driver = Grid.driver(); | ||
assertNotNull(driver); | ||
// And now use this to visit Google | ||
driver.get("http://www.google.com"); | ||
|
||
// Find the text input element by its name | ||
WebElement element = driver.findElement(By.name("q")); | ||
|
||
// Enter something to search for | ||
element.sendKeys("Cheese!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> | ||
<suite verbose="1" name="Edge Browser Test Suite" annotations="JDK"> | ||
|
||
<!-- SELENIUM CONFIGURATION --> | ||
<parameter name="browser" value="*microsoftedge" /> | ||
<parameter name="platform" value="Windows 10" /> | ||
<parameter name="useSauceLabGrid" value="true" /> | ||
<parameter name="seleniumhost" value="ondemand.saucelabs.com" /> | ||
<parameter name="seleniumport" value="80"></parameter> | ||
|
||
<test verbose="2" name="Edge-SauceCloud-Test" annotations="JDK"> | ||
<classes> | ||
<class name="com.paypal.selion.sample.EdgeBrowserTest"></class> | ||
</classes> | ||
</test> | ||
|
||
</suite> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters