1 |
|
/**
|
2 |
|
*
|
3 |
|
*/
|
4 |
|
package eu.etaxonomy.dataportal.selenium;
|
5 |
|
|
6 |
|
import java.io.IOException;
|
7 |
|
|
8 |
|
import org.openqa.selenium.WebDriver;
|
9 |
|
import org.openqa.selenium.chrome.ChromeDriver;
|
10 |
|
import org.openqa.selenium.firefox.FirefoxDriver;
|
11 |
|
import org.openqa.selenium.firefox.FirefoxProfile;
|
12 |
|
import org.openqa.selenium.ie.InternetExplorerDriver;
|
13 |
|
|
14 |
|
/**
|
15 |
|
* @author a.kohlbecker
|
16 |
|
*
|
17 |
|
*/
|
18 |
|
public abstract class CDMDataPortalTestBase {
|
19 |
|
|
20 |
|
private static final String FIREBUG_VERSION = "1.6.2";
|
21 |
|
|
22 |
|
protected WebDriver driver;
|
23 |
|
|
24 |
|
public WebDriver initChromeDriver() {
|
25 |
|
//System.setProperty("webdriver.chrome.bin", "C:\\Dokumente und Einstellungen\\a.kohlbecker.BGBM\\Lokale Einstellungen\\Anwendungsdaten\\Google\\Chrome\\Application\\chrome.exe");
|
26 |
|
return new ChromeDriver();
|
27 |
|
}
|
28 |
|
|
29 |
|
public WebDriver initInternetExplorerDriver() {
|
30 |
|
return new InternetExplorerDriver();
|
31 |
|
}
|
32 |
|
|
33 |
|
/**
|
34 |
|
* -Dwebdriver.firefox.bin=/usr/lib/iceweasel/firefox-bin
|
35 |
|
*
|
36 |
|
* See http://code.google.com/p/selenium/wiki/FirefoxDriverInternals
|
37 |
|
* @return
|
38 |
|
*/
|
39 |
|
public WebDriver initFirefoxDriver() {
|
40 |
|
//System.setProperty("webdriver.firefox.bin", "C:\\Programme\\Mozilla Firefox 3\\firefox.exe");
|
41 |
|
//System.out.println("##:" + System.getProperty("webdriver.firefox.bin"));
|
42 |
|
FirefoxProfile firefoxProfile = new FirefoxProfile();
|
43 |
|
try {
|
44 |
|
|
45 |
|
firefoxProfile.addExtension(this.getClass(), "/org/mozilla/addons/firebug-" + FIREBUG_VERSION + ".xpi");
|
46 |
|
firefoxProfile.setPreference("extensions.firebug.currentVersion", FIREBUG_VERSION); // avoid displaying firt run page
|
47 |
|
|
48 |
|
// --- allow enabling incompatible addons
|
49 |
|
// firefoxProfile.addExtension(this.getClass(), "/org/mozilla/addons/add_on_compatibility_reporter-0.8.3-fx+tb+sm.xpi");
|
50 |
|
// firefoxProfile.setPreference("extensions.acr.firstrun", false);
|
51 |
|
// firefoxProfile.setPreference("extensions.enabledAddons", "fxdriver@googlecode.com,compatibility@addons.mozilla.org:0.8.3,fxdriver@googlecode.com:0.9.7376,{CAFEEFAC-0016-0000-0024-ABCDEFFEDCBA}:6.0.24,{20a82645-c095-46ed-80e3-08825760534b}:0.0.0,meetinglauncher@iconf.net:4.10.12.316,jqs@sun.com:1.0,{972ce4c6-7e08-4474-a285-3208198ce6fd}:4.0");
|
52 |
|
// firefoxProfile.setPreference("extensions.checkCompatibility", false);
|
53 |
|
// firefoxProfile.setPreference("extensions.checkCompatibility.4.0", false);
|
54 |
|
// firefoxProfile.setPreference("extensions.checkCompatibility.4.1", false);
|
55 |
|
|
56 |
|
} catch (IOException e) {
|
57 |
|
// TODO Auto-generated catch block
|
58 |
|
e.printStackTrace();
|
59 |
|
System.exit(-1);
|
60 |
|
}
|
61 |
|
driver = new FirefoxDriver(firefoxProfile);
|
62 |
|
|
63 |
|
return driver;
|
64 |
|
}
|
65 |
|
|
66 |
|
}
|
renaming