mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-09 22:01:02 +00:00
Merge branch 'master' into jetty9
This commit is contained in:
commit
6103a957f8
48 files changed
+194
-69
No files matched your search
@@ -6,6 +6,6 @@ Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: SAP
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Require-Bundle: org.junit4;bundle-version="4.8.2",
|
||||
org.openqa.selenium.osgi;bundle-version="2.25.0",
|
||||
org.openqa.selenium.osgi;bundle-version="2.34.0",
|
||||
com.sap.sailing.mongodb;bundle-version="1.0.0",
|
||||
com.mongodb.driver;bundle-version="2.6.2"
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
@@ -41,7 +41,7 @@
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
|
||||
<skip>false</skip>
|
||||
<excludes>
|
||||
<exclude>**/core/**</exclude>
|
||||
</excludes>
|
||||
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
package com.sap.sailing.selenium.core;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.JavascriptExecutor;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebDriver.TargetLocator;
|
||||
import org.openqa.selenium.WebDriverException;
|
||||
|
||||
public class WebDriverWindow {
|
||||
|
||||
private static int instanceCount = 0;
|
||||
|
||||
private static final String JAVA_SCRIPT = "var anchorTag = document.createElement('a');" +
|
||||
"anchorTag.setAttribute('id', '%s');" +
|
||||
"anchorTag.setAttribute('href', '%s');" +
|
||||
"anchorTag.setAttribute('target', '_blank');" +
|
||||
"anchorTag.setAttribute('style', 'display:block;');" +
|
||||
"anchorTag.appendChild(document.createTextNode('nwh'));" +
|
||||
"document.getElementsByTagName('body')[0].appendChild(anchorTag);";
|
||||
|
||||
private static String createUniqueName() {
|
||||
return "WebDriverWindow_" + instanceCount++;
|
||||
}
|
||||
|
||||
private WebDriver driver;
|
||||
|
||||
private String name;
|
||||
|
||||
private String handle;
|
||||
|
||||
private String parent;
|
||||
|
||||
/**
|
||||
* Creates a new window for given web driver
|
||||
*
|
||||
* @param driver
|
||||
* WebDriver instance
|
||||
* @param url
|
||||
* Initial URL to load
|
||||
*/
|
||||
public WebDriverWindow(WebDriver driver, String url) {
|
||||
this.driver = driver;
|
||||
this.name = createUniqueName();
|
||||
|
||||
createWindow(url);
|
||||
// Switch to that window and load the url to wait
|
||||
switchToWindow();//.get(url);
|
||||
}
|
||||
|
||||
public String getWindowHandle() {
|
||||
return this.handle;
|
||||
}
|
||||
|
||||
public String getParentHandle() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
switchToWindow().close();
|
||||
this.handle = "";
|
||||
// Switch back to the parent window
|
||||
this.driver.switchTo().window(this.parent);
|
||||
}
|
||||
|
||||
public WebDriver switchToWindow() {
|
||||
checkForClosed();
|
||||
|
||||
return switchTo(this.handle);
|
||||
}
|
||||
|
||||
public WebDriver switchToParent() {
|
||||
checkForClosed();
|
||||
|
||||
return switchTo(this.parent);
|
||||
}
|
||||
|
||||
private void createWindow(String url) {
|
||||
// Record old handles
|
||||
Set<String> oldHandles = this.driver.getWindowHandles();
|
||||
this.parent = this.driver.getWindowHandle();
|
||||
|
||||
// Inject an anchor element
|
||||
injectAnchorTag(this.name, url);
|
||||
|
||||
// Click on the anchor element
|
||||
this.driver.findElement(By.id(this.name)).click();
|
||||
|
||||
this.handle = getNewHandle(oldHandles);
|
||||
}
|
||||
|
||||
private String getNewHandle(Set<String> oldHandles) {
|
||||
Set<String> newHandles = this.driver.getWindowHandles();
|
||||
newHandles.removeAll(oldHandles);
|
||||
|
||||
// Find the new window
|
||||
for(String handle : newHandles)
|
||||
return handle;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void checkForClosed() {
|
||||
if(this.handle == null || this.handle.equals(""))
|
||||
throw new WebDriverException("Web Window closed or not initialized");
|
||||
}
|
||||
|
||||
private void injectAnchorTag(String id, String url) {
|
||||
JavascriptExecutor executor = (JavascriptExecutor) this.driver;
|
||||
executor.executeScript(String.format(JAVA_SCRIPT, id, url));
|
||||
}
|
||||
|
||||
private WebDriver switchTo(String handle) {
|
||||
TargetLocator locator = this.driver.switchTo();
|
||||
|
||||
return locator.window(handle);
|
||||
}
|
||||
}
|
||||
@@ -1,42 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="selenium-java-2.25.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/guava-12.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/hamcrest-core-1.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/apache-mime4j-0.6.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/bsh-1.3.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cglib-nodep-2.1_3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-codec-1.6.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-collections-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-exec-1.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-io-2.0.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-io-2.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-jxpath-1.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-lang-2.6.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-lang3-3.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-logging-1.1.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cssparser-0.9.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/hamcrest-library-1.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/htmlunit-2.9.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/htmlunit-core-js-2.9.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/httpclient-4.1.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/httpcore-4.1.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/httpmime-4.1.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cssparser-0.9.9.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/guava-14.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/hamcrest-core-1.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/hamcrest-library-1.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/htmlunit-2.12.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/htmlunit-core-js-2.12.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/httpclient-4.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/httpcore-4.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/httpmime-4.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/ini4j-0.5.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jcommander-1.13.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jcommander-1.29.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jetty-websocket-8.1.8.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jna-3.4.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jna-platform-3.4.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/json-20080701.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/junit-dep-4.10.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/nekohtml-1.9.15.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/netty-3.2.7.Final.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/operadriver-0.14.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/junit-dep-4.11.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/nekohtml-1.9.17.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/netty-3.5.7.Final.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/operadriver-1.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/phantomjsdriver-1.0.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/protobuf-java-2.4.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/sac-1.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/serializer-2.7.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/testng-6.0.1-nobsh-noguice.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/webbit-0.4.8-SNAPSHOT.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/testng-6.8.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/xalan-2.7.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/xercesImpl-2.9.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/xml-apis-1.3.04.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/xercesImpl-2.10.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/xml-apis-1.4.01.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="selenium-java-2.34.0.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
||||
@@ -2,44 +2,45 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Selenium
|
||||
Bundle-SymbolicName: org.openqa.selenium.osgi
|
||||
Bundle-Version: 2.25.0
|
||||
Bundle-ClassPath: selenium-java-2.25.0.jar,
|
||||
Bundle-Version: 2.34.0
|
||||
Bundle-ClassPath: selenium-java-2.34.0.jar,
|
||||
lib/apache-mime4j-0.6.jar,
|
||||
lib/bsh-1.3.0.jar,
|
||||
lib/cglib-nodep-2.1_3.jar,
|
||||
lib/commons-codec-1.6.jar,
|
||||
lib/commons-collections-3.2.1.jar,
|
||||
lib/commons-exec-1.1.jar,
|
||||
lib/commons-io-2.0.1.jar,
|
||||
lib/commons-io-2.2.jar,
|
||||
lib/commons-jxpath-1.3.jar,
|
||||
lib/commons-lang-2.6.jar,
|
||||
lib/commons-lang3-3.1.jar,
|
||||
lib/commons-logging-1.1.1.jar,
|
||||
lib/cssparser-0.9.5.jar,
|
||||
lib/guava-12.0.jar,
|
||||
lib/hamcrest-core-1.1.jar,
|
||||
lib/hamcrest-library-1.1.jar,
|
||||
lib/htmlunit-2.9.jar,
|
||||
lib/htmlunit-core-js-2.9.jar,
|
||||
lib/httpclient-4.1.3.jar,
|
||||
lib/httpcore-4.1.3.jar,
|
||||
lib/httpmime-4.1.3.jar,
|
||||
lib/cssparser-0.9.9.jar,
|
||||
lib/guava-14.0.jar,
|
||||
lib/hamcrest-core-1.3.jar,
|
||||
lib/hamcrest-library-1.3.jar,
|
||||
lib/htmlunit-2.12.jar,
|
||||
lib/htmlunit-core-js-2.12.jar,
|
||||
lib/httpclient-4.2.1.jar,
|
||||
lib/httpcore-4.2.1.jar,
|
||||
lib/httpmime-4.2.1.jar,
|
||||
lib/ini4j-0.5.2.jar,
|
||||
lib/jcommander-1.13.jar,
|
||||
lib/jcommander-1.29.jar,
|
||||
lib/jetty-websocket-8.1.8.jar,
|
||||
lib/jna-3.4.0.jar,
|
||||
lib/jna-platform-3.4.0.jar,
|
||||
lib/json-20080701.jar,
|
||||
lib/junit-dep-4.10.jar,
|
||||
lib/nekohtml-1.9.15.jar,
|
||||
lib/netty-3.2.7.Final.jar,
|
||||
lib/operadriver-0.14.jar,
|
||||
lib/junit-dep-4.11.jar,
|
||||
lib/nekohtml-1.9.17.jar,
|
||||
lib/netty-3.5.7.Final.jar,
|
||||
lib/operadriver-1.3.jar,
|
||||
lib/phantomjsdriver-1.0.4.jar,
|
||||
lib/protobuf-java-2.4.1.jar,
|
||||
lib/sac-1.3.jar,
|
||||
lib/serializer-2.7.1.jar,
|
||||
lib/testng-6.0.1-nobsh-noguice.jar,
|
||||
lib/webbit-0.4.8-SNAPSHOT.jar,
|
||||
lib/testng-6.8.5.jar,
|
||||
lib/xalan-2.7.1.jar,
|
||||
lib/xercesImpl-2.9.1.jar,
|
||||
lib/xml-apis-1.3.04.jar
|
||||
lib/xercesImpl-2.10.0.jar,
|
||||
lib/xml-apis-1.4.01.jar
|
||||
Bundle-Vendor: openqa
|
||||
Export-Package: com.google.common.annotations,
|
||||
com.google.common.base,
|
||||
@@ -67,14 +68,17 @@ Export-Package: com.google.common.annotations,
|
||||
org.openqa.selenium.interactions.internal,
|
||||
org.openqa.selenium.interactions.touch,
|
||||
org.openqa.selenium.internal,
|
||||
org.openqa.selenium.internal.seleniumemulation,
|
||||
org.openqa.selenium.io,
|
||||
org.openqa.selenium.iphone,
|
||||
org.openqa.selenium.lift,
|
||||
org.openqa.selenium.lift.find,
|
||||
org.openqa.selenium.lift.match,
|
||||
org.openqa.selenium.logging,
|
||||
org.openqa.selenium.logging.profiler,
|
||||
org.openqa.selenium.net,
|
||||
org.openqa.selenium.os,
|
||||
org.openqa.selenium.phantomjs,
|
||||
org.openqa.selenium.remote,
|
||||
org.openqa.selenium.remote.html5,
|
||||
org.openqa.selenium.remote.internal,
|
||||
|
||||
@@ -1,38 +1,39 @@
|
||||
bin.includes = META-INF/,\
|
||||
lib/commons-io-2.2.jar,\
|
||||
lib/commons-lang3-3.1.jar,\
|
||||
lib/cssparser-0.9.9.jar,\
|
||||
lib/guava-14.0.jar,\
|
||||
lib/hamcrest-core-1.3.jar,\
|
||||
lib/hamcrest-library-1.3.jar,\
|
||||
lib/htmlunit-2.12.jar,\
|
||||
lib/htmlunit-core-js-2.12.jar,\
|
||||
lib/httpclient-4.2.1.jar,\
|
||||
lib/httpcore-4.2.1.jar,\
|
||||
lib/httpmime-4.2.1.jar,\
|
||||
lib/jcommander-1.29.jar,\
|
||||
lib/jetty-websocket-8.1.8.jar,\
|
||||
lib/junit-dep-4.11.jar,\
|
||||
lib/nekohtml-1.9.17.jar,\
|
||||
lib/netty-3.5.7.Final.jar,\
|
||||
lib/operadriver-1.3.jar,\
|
||||
lib/phantomjsdriver-1.0.4.jar,\
|
||||
lib/testng-6.8.5.jar,\
|
||||
lib/xercesImpl-2.10.0.jar,\
|
||||
lib/xml-apis-1.4.01.jar,\
|
||||
selenium-java-2.34.0.jar,\
|
||||
lib/apache-mime4j-0.6.jar,\
|
||||
lib/bsh-1.3.0.jar,\
|
||||
lib/cglib-nodep-2.1_3.jar,\
|
||||
lib/commons-codec-1.6.jar,\
|
||||
lib/commons-collections-3.2.1.jar,\
|
||||
lib/commons-exec-1.1.jar,\
|
||||
lib/commons-io-2.0.1.jar,\
|
||||
lib/commons-jxpath-1.3.jar,\
|
||||
lib/commons-lang-2.6.jar,\
|
||||
lib/commons-logging-1.1.1.jar,\
|
||||
lib/cssparser-0.9.5.jar,\
|
||||
lib/hamcrest-library-1.1.jar,\
|
||||
lib/htmlunit-2.9.jar,\
|
||||
lib/htmlunit-core-js-2.9.jar,\
|
||||
lib/httpclient-4.1.3.jar,\
|
||||
lib/httpcore-4.1.3.jar,\
|
||||
lib/httpmime-4.1.3.jar,\
|
||||
lib/ini4j-0.5.2.jar,\
|
||||
lib/jcommander-1.13.jar,\
|
||||
lib/jna-3.4.0.jar,\
|
||||
lib/jna-platform-3.4.0.jar,\
|
||||
lib/json-20080701.jar,\
|
||||
lib/junit-dep-4.10.jar,\
|
||||
lib/nekohtml-1.9.15.jar,\
|
||||
lib/netty-3.2.7.Final.jar,\
|
||||
lib/operadriver-0.14.jar,\
|
||||
lib/protobuf-java-2.4.1.jar,\
|
||||
lib/sac-1.3.jar,\
|
||||
lib/serializer-2.7.1.jar,\
|
||||
lib/testng-6.0.1-nobsh-noguice.jar,\
|
||||
lib/webbit-0.4.8-SNAPSHOT.jar,\
|
||||
lib/xalan-2.7.1.jar,\
|
||||
lib/xercesImpl-2.9.1.jar,\
|
||||
lib/xml-apis-1.3.04.jar,\
|
||||
lib/guava-12.0.jar,\
|
||||
lib/hamcrest-core-1.1.jar,\
|
||||
selenium-java-2.25.0.jar
|
||||
lib/xalan-2.7.1.jar
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
@@ -8,6 +8,6 @@
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>org.openqa.selenium.osgi</artifactId>
|
||||
<version>2.25.0</version>
|
||||
<version>2.34.0</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user