List of usage examples for org.openqa.selenium.remote LocalFileDetector LocalFileDetector
LocalFileDetector
From source file:com.opera.core.systems.testing.drivers.TestOperaDriverSupplier.java
License:Apache License
public TestOperaDriver get() { // Uncomment this if you wish to connect Opera manually: //settings.autostart(false); settings.logging().setLevel(Level.CONFIG); TestOperaDriver driver = new TestOperaDriver(settings); driver.setFileDetector(new LocalFileDetector()); return driver; }
From source file:com.partnet.automation.selenium.AbstractConfigurableDriverProvider.java
License:Apache License
/** * Helper method to launch remote web driver. * * At times there are issues with starting the remote web driver. For firefox, * problems with locking port 7054 can arise. * * See the Selenium <a/* w ww . j a v a 2s .c o m*/ * href="https://code.google.com/p/selenium/issues/detail?id=4790">bug</a> for * more info * * A special case needs to be performed for the Android browser, since it can not be cast to {@link RemoteWebDriver} * * @param capabilities web driver capabilities. * @return {@link WebDriver} instance of the remote web driver * */ protected WebDriver initRemoteWebDriver(DesiredCapabilities capabilities) { URL remoteUrl = getRemoteSeleniumUrl(); LOG.debug("Remote Selenium URL: {}", remoteUrl.toString()); WebDriver driver = null; boolean isAndroid = false; int tries = 1; if (capabilities.getCapability(CapabilityType.BROWSER_NAME).equals(ANDROID_BROWSER_NAME)) { isAndroid = true; } while (driver == null) { LOG.debug("Try {} {}", tries, capabilities.toString()); try { if (isAndroid) { driver = new AndroidDriver(remoteUrl, capabilities); } else { driver = new RemoteWebDriver(remoteUrl, capabilities); } } catch (WebDriverException e) { LOG.error("Remote WebDriver was unable to start! " + e.getMessage(), e); if (tries >= Integer.getInteger(REMOTE_WEBDRIVER_RETRY_ATTEMPTS, 10)) { throw e; } sleep(Integer.getInteger(REMOTE_WEBDRIVER_RETRY_PAUSE_MILLIS, 5000) * tries); tries++; driver = null; } } if (!isAndroid) { // allow screenshots to be taken driver = new Augmenter().augment(driver); } // Allow files from the host to be uploaded to a remote browser ((RemoteWebDriver) driver).setFileDetector(new LocalFileDetector()); return driver; }
From source file:com.seleniumtests.browserfactory.SeleniumGridDriverFactory.java
License:Apache License
@Override public WebDriver createWebDriver() { // create capabilities, specific to OS MutableCapabilities capabilities = createSpecificGridCapabilities(webDriverConfig); capabilities.merge(driverOptions);/*from w w w . j ava2 s . com*/ // app must be uploaded before driver creation because driver will need it in mobile app testing // upload file on all available grids as we don't know which one will be chosen before driver has been created for (SeleniumGridConnector gridConnector : gridConnectors) { gridConnector.uploadMobileApp(capabilities); } // connection to grid is made here driver = getDriver(capabilities); setImplicitWaitTimeout(webDriverConfig.getImplicitWaitTimeout()); if (webDriverConfig.getPageLoadTimeout() >= 0 && SeleniumTestsContextManager.isWebTest()) { setPageLoadTimeout(webDriverConfig.getPageLoadTimeout()); } this.setWebDriver(driver); runWebDriver(); ((RemoteWebDriver) driver).setFileDetector(new LocalFileDetector()); return driver; }
From source file:com.sinet.gage.uitest.helper.CommonHelper.java
/** * Method used to upload a file//from w ww.java2 s .com * * @param element web element of file needs to be upload * @param filePath file path name of file needs to be upload * */ public static void fileUpload(WebElement element, String filePath, boolean isGrid) { try { // File file = new File( new File( "." ).getCanonicalPath() + filePath ); File file = new File(filePath); file.toURI(); if (isGrid) { ((RemoteWebElement) element).setFileDetector(new LocalFileDetector()); } element.sendKeys(file.getAbsolutePath()); // } catch ( IOException e ) { } catch (Exception e) { e.printStackTrace(); } }
From source file:de.dentrassi.pm.testing.TestSuite.java
License:Open Source License
protected static RemoteWebDriver createSauce(final Platform os, final String browser, final String version) throws MalformedURLException { final DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(CapabilityType.BROWSER_NAME, browser); if (version != null) { capabilities.setCapability(CapabilityType.VERSION, version); }/* www . j a v a 2 s . co m*/ capabilities.setCapability(CapabilityType.PLATFORM, os); capabilities.setCapability("name", "Package Drone Main Test"); final RemoteWebDriver driver = new RemoteWebDriver(new URL( String.format("http://%s:%s@ondemand.saucelabs.com:80/wd/hub", SAUCE_USER_NAME, SAUCE_ACCESS_KEY)), capabilities); driver.setFileDetector(new LocalFileDetector()); return driver; }
From source file:de.ppi.selenium.browser.DefaultWebDriverFactory.java
License:Apache License
@Override public WebDriver createWebDriver(Map<String, String> options, DesiredCapabilities capabilities) throws IOException { ClientProperties properties = new ClientProperties(options.get(CLIENT_PROPERTIES_KEY)); WebDriver wd = null;/*from ww w .j a v a 2 s . c o m*/ DesiredCapabilities desiredCapabilities = new DesiredCapabilities(capabilities); String browser = properties.getBrowser(); if (properties.isUseGrid()) { RemoteWebDriver remoteWebDriver = new RemoteWebDriver(new URL(properties.getGridUrl()), capabilities); remoteWebDriver.setFileDetector(new LocalFileDetector()); wd = remoteWebDriver; } else { if (browser == null || browser.equals("")) { throw new RuntimeException( "Browser cannot be null. Please set 'browser' in client properties. Supported browser types: IE, Firefox, Chrome, Safari, HtmlUnit."); } else if (browser.equalsIgnoreCase("ie") || browser.equalsIgnoreCase("iexplore") || browser.equalsIgnoreCase("*iexplore")) { String webdriverIEDriver = properties.getWebDriverIEDriver(); if (webdriverIEDriver != null) { System.setProperty("webdriver.ie.driver", webdriverIEDriver); } String browserVersion = properties.getBrowserVersion(); if (browserVersion == null || browserVersion.equals("")) { throw new RuntimeException( "When using IE as the browser, please set 'browser.version' in client properties"); } else { if (browserVersion.startsWith("9")) { desiredCapabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); desiredCapabilities.setCapability( InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true); wd = new InternetExplorerDriver(desiredCapabilities); } else { wd = new InternetExplorerDriver(desiredCapabilities); } } } else if ((browser.equalsIgnoreCase("firefox") || browser.equalsIgnoreCase("*firefox"))) { final String ffProfileFolder = properties.getFirefoxProfileFolder(); final String ffProfileFile = properties.getFirefoxProfileFile(); final String path = properties.getFfBinaryPath(); final FirefoxProfile ffp; if (ffProfileFolder != null) { ffp = new FirefoxProfile(new File(ffProfileFolder)); } else { ffp = new FirefoxProfile(); } if (ffProfileFile != null) { addPreferences(ffp, ffProfileFile); } addPreferences(ffp, properties); List<String> ffExtensions = properties.getFirefoxExtensions(); if (ffExtensions != null && ffExtensions.size() > 0) { addExtensionsToFirefoxProfile(ffp, ffExtensions); } if (path != null) { FirefoxBinary fireFox = getFFBinary(path); wd = new FirefoxDriver(fireFox, ffp, desiredCapabilities); } else { wd = new FirefoxDriver(new FirefoxBinary(), ffp, desiredCapabilities); } } else if (browser.equalsIgnoreCase("chrome")) { final String webdriverChromeDriver = properties.getWebDriverChromeDriver(); if (webdriverChromeDriver != null) { System.setProperty("webdriver.chrome.driver", webdriverChromeDriver); } final ChromeOptions chromeOptions = new ChromeOptions(); final String chromeBinaryPath = properties.getChromeBinaryPath(); if (chromeBinaryPath != null) { chromeOptions.setBinary(chromeBinaryPath); } if (properties.getAcceptedLanguages() != null) { final Map<String, Object> prefs = new HashMap<String, Object>(); prefs.put("intl.accept_languages", properties.getAcceptedLanguages()); chromeOptions.setExperimentalOption("prefs", prefs); } desiredCapabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions); wd = new ChromeDriver(desiredCapabilities); } else if (browser.equalsIgnoreCase("safari")) { wd = new SafariDriver(desiredCapabilities); } else if (browser.equalsIgnoreCase("htmlunit")) { final BrowserVersion browserVersion = BrowserVersion.FIREFOX_45; if (properties.getAcceptedLanguages() != null) { browserVersion.setBrowserLanguage(properties.getAcceptedLanguages().split(",")[0]); } wd = new HtmlUnitDriver(browserVersion); ((HtmlUnitDriver) wd).setJavascriptEnabled(true); } else if (browser.equalsIgnoreCase("phantomjs")) { final String webdriverPhantomJSDriver = properties.getWebDriverPhantomJSDriver(); if (properties.getAcceptedLanguages() != null) { desiredCapabilities.setCapability("phantomjs.page.customHeaders.Accept-Language", properties.getAcceptedLanguages()); } if (webdriverPhantomJSDriver != null) { desiredCapabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, webdriverPhantomJSDriver); wd = new PhantomJSDriver(desiredCapabilities); } else { wd = new PhantomJSDriver(ResolvingPhantomJSDriverService.createDefaultService(), desiredCapabilities); } } else { throw new IllegalArgumentException("Unsupported browser type: " + browser + ". Supported browser types: IE, Firefox, Chrome, Safari, HtmlUnit, phantomjs."); } // move browser windows to specific position. It's useful for // debugging... final int browserInitPositionX = properties.getBrowserInitPositionX(); final int browserInitPositionY = properties.getBrowserInitPositionY(); if (browserInitPositionX != 0 || browserInitPositionY != 0) { wd.manage().window().setSize(new Dimension(1280, 1024)); wd.manage().window().setPosition(new Point(browserInitPositionX, browserInitPositionY)); } wd.manage().timeouts().implicitlyWait(properties.getAppearWaitTime(), TimeUnit.MILLISECONDS); } return wd; }
From source file:minium.web.config.WebDriverFactory.java
License:Apache License
public WebDriver create(WebDriverProperties webDriverProperties) { DesiredCapabilities desiredCapabilities = new DesiredCapabilities( webDriverProperties.getDesiredCapabilities()); DesiredCapabilities requiredCapabilities = new DesiredCapabilities( webDriverProperties.getRequiredCapabilities()); WebDriver webDriver = null;//from ww w . j a va 2 s .co m if (webDriverProperties.getUrl() != null) { RemoteWebDriver remoteDriver = new RemoteWebDriver(webDriverProperties.getUrl(), desiredCapabilities, requiredCapabilities); remoteDriver.setFileDetector(new LocalFileDetector()); webDriver = remoteDriver; } else { String browserName = desiredCapabilities == null ? null : desiredCapabilities.getBrowserName(); if (Strings.isNullOrEmpty(browserName)) browserName = BrowserType.CHROME; webDriver = WebDriverType.typeFor(browserName).create(this, desiredCapabilities, requiredCapabilities); } WindowProperties window = webDriverProperties.getWindow(); if (window != null) { DimensionProperties size = window.getSize(); PointProperties position = window.getPosition(); if (size != null) webDriver.manage().window().setSize(new Dimension(size.getWidth(), size.getHeight())); if (position != null) webDriver.manage().window().setPosition(new Point(position.getX(), position.getY())); if (window.isMaximized()) { webDriver.manage().window().maximize(); } } return webDriver instanceof TakesScreenshot ? webDriver : new Augmenter().augment(webDriver); }
From source file:org.alfresco.grid.WebDriverFactory.java
License:Open Source License
/** * Creates a new instance of an {@link WebDriver} * @return {@link DesiredCapabilities} type of browser capability * @throws UnsupportedOperationException if grid url is invalid *///from w w w . j ava 2 s. c om private WebDriver getRemoteDriver(DesiredCapabilities capability) { URL url; if (gridUrl == null || gridUrl.isEmpty()) { throw new UnsupportedOperationException("Grid url is required"); } try { url = new URL(gridUrl); } catch (MalformedURLException e) { throw new UnsupportedOperationException( String.format("A valid grid url is required instead of given url: %s", gridUrl), e); } capability.setCapability(CapabilityType.TAKES_SCREENSHOT, true); RemoteWebDriver remoteWebDriver = new RemoteWebDriver(url, capability); remoteWebDriver.setFileDetector(new LocalFileDetector()); return remoteWebDriver; }
From source file:org.aludratest.service.gui.web.selenium.selenium2.Selenium2Driver.java
License:Apache License
/** @param url the URL for which to create a WebDriver instance. * @param arguments Additional arguments to include for the WebDriver instance, or an empty array. * @return a freshly created instance of the related WebDriver class */ public WebDriver newRemoteDriver(URL url, String[] arguments) { AludraSeleniumHttpCommandExecutor executor = new AludraSeleniumHttpCommandExecutor(url); DesiredCapabilities caps = capabilities; if (arguments != null && arguments.length > 0) { caps = new DesiredCapabilities(capabilities); // this looks strange, but is the only way to avoid having all Threads sharing the same ChromeOptions object ChromeOptions opts = (ChromeOptions) createChromeCaps().getCapability(ChromeOptions.CAPABILITY); if (opts != null) { opts.addArguments(arguments); caps.setCapability(ChromeOptions.CAPABILITY, opts); }/* ww w .ja v a 2 s . c o m*/ } try { RemoteWebDriver driver = new RemoteWebDriver(executor, caps); driver.setFileDetector(new LocalFileDetector()); return driver; } catch (WebDriverException e) { LoggerFactory.getLogger(Selenium2Driver.class).error( "Could not create remote web driver. Last remote HTTP response: " + executor.getLastResponse()); throw e; } }
From source file:org.apache.directory.fortress.web.integration.FortressWebSeleniumITCase.java
License:Apache License
private void users() { String TEST_ROLE_NAME = "T15ROLE1"; String TEST_ADMIN_ROLE_NAME = "T3AdmRle1"; /*****//from w w w . j av a 2 s.c om * USERS_PAGE TESTS */ driver.findElement(By.linkText("USERS")).click(); //driver.findElement( By.id( "roleRb" ) ).click(); driver.findElement(By.id("roleAssignLinkLbl")).click(); TUtils.sleep(1); driver.findElement(By.linkText(">")).click(); TUtils.sleep(1); driver.findElement(By.linkText(GlobalIds.SELECT)).click(); TUtils.sleep(1); driver.findElement(By.name("userformsearchfields:" + GlobalIds.SEARCH)).click(); driver.findElement(By.id(GlobalIds.FIELD_1)).clear(); driver.findElement(By.id(GlobalIds.FIELD_1)).sendKeys("dev1"); driver.findElement(By.id("ouAssignLinkLbl")).click(); TUtils.sleep(1); driver.findElement(By.linkText(GlobalIds.SELECT)).click(); TUtils.sleep(1); driver.findElement(By.name("userformsearchfields:" + GlobalIds.SEARCH)).click(); TUtils.sleep(1); WebElement table = driver.findElement(By.id("usertreegrid")); List<WebElement> allRows = table.findElements(By.tagName("tr")); allRows.get(4).findElement(By.className("imxt-cell")).click(); TUtils.sleep(1); allRows.get(5).findElement(By.className("imxt-cell")).click(); TUtils.sleep(1); allRows.get(6).findElement(By.className("imxt-cell")).click(); TUtils.sleep(1); driver.findElement(By.name(GlobalIds.CLEAR)).click(); TUtils.sleep(1); driver.findElement(By.id(GlobalIds.USER_ID)).sendKeys("selTestU1"); driver.findElement(By.id(GlobalIds.PASSWORD)).clear(); driver.findElement(By.id(GlobalIds.PASSWORD)).sendKeys("password"); driver.findElement(By.id(GlobalIds.OU)).clear(); driver.findElement(By.id(GlobalIds.OU)).sendKeys("dev1"); driver.findElement(By.name(GlobalIds.OU_SEARCH)).click(); TUtils.sleep(2); driver.findElement(By.linkText(GlobalIds.SELECT)).click(); TUtils.sleep(1); /* TODO: FIX ME: driver.findElement( By.name( GlobalIds.POLICY_SEARCH ) ).click(); TUtils.sleep( 2 ); driver.findElement( By.linkText( ">" ) ).click(); TUtils.sleep( 1 ); driver.findElement( By.linkText( GlobalIds.SELECT ) ).click(); TUtils.sleep( 1 ); */ driver.findElement(By.name(GlobalIds.ADD)).click(); TUtils.sleep(1); driver.findElement(By.id(GlobalIds.ROLE_ASSIGNMENTS_LABEL)).click(); //( ( JavascriptExecutor ) driver ).executeScript( "$(document.getElementById('roles')).val('role1');" ); driver.findElement(By.id(GlobalIds.ASSIGN_NEW_ROLE)).sendKeys(TEST_ROLE_NAME); driver.findElement(By.id(GlobalIds.BEGIN_TIME_RC)).clear(); driver.findElement(By.id(GlobalIds.BEGIN_TIME_RC)).sendKeys("8:00 AM"); driver.findElement(By.id(GlobalIds.END_TIME_RC)).clear(); driver.findElement(By.id(GlobalIds.END_TIME_RC)).sendKeys("5:00 PM"); driver.findElement(By.id(GlobalIds.BEGIN_DATE_RC)).clear(); driver.findElement(By.id(GlobalIds.BEGIN_DATE_RC)).sendKeys("1/1/2013"); driver.findElement(By.id(GlobalIds.END_DATE_RC)).clear(); driver.findElement(By.id(GlobalIds.END_DATE_RC)).sendKeys("1/1/2099"); driver.findElement(By.id(GlobalIds.BEGIN_LOCK_DATE_RC)).clear(); driver.findElement(By.id(GlobalIds.BEGIN_LOCK_DATE_RC)).sendKeys("6/1/2013"); driver.findElement(By.id(GlobalIds.END_LOCK_DATE_RC)).clear(); driver.findElement(By.id(GlobalIds.END_LOCK_DATE_RC)).sendKeys("6/15/2013"); driver.findElement(By.id(GlobalIds.TIMEOUT_RC)).clear(); driver.findElement(By.id(GlobalIds.TIMEOUT_RC)).sendKeys("120"); driver.findElement(By.id(GlobalIds.SUNDAY_RC)).click(); driver.findElement(By.id(GlobalIds.MONDAY_RC)).click(); driver.findElement(By.id(GlobalIds.TUESDAY_RC)).click(); driver.findElement(By.id(GlobalIds.WEDNESDAY_RC)).click(); driver.findElement(By.id(GlobalIds.THURSDAY_RC)).click(); driver.findElement(By.id(GlobalIds.FRIDAY_RC)).click(); driver.findElement(By.id(GlobalIds.SATURDAY_RC)).click(); driver.findElement(By.name(GlobalIds.ASSIGN)).click(); TUtils.sleep(1); driver.findElement(By.id(GlobalIds.ROLE_ASSIGNMENTS_LABEL)).click(); TUtils.sleep(1); driver.findElement(By.id(GlobalIds.ASSIGN_NEW_ROLE)).clear(); TUtils.sleep(2); driver.findElement(By.name(GlobalIds.ROLES_SEARCH)).click(); TUtils.sleep(2); driver.findElement(By.linkText("3")).click(); TUtils.sleep(2); driver.findElement(By.linkText(GlobalIds.SELECT)).click(); TUtils.sleep(2); driver.findElement(By.name(GlobalIds.ASSIGN)).click(); TUtils.sleep(2); driver.findElement(By.id("adminRoleAssignmentsLabel")).click(); /* if(driver.findElement( By.name( "adminRoles" ) ).isDisplayed()) { System.out.println("adminRoles is displayed!!!"); } else { System.out.println("adminRoles is NOT displayed!!!"); } */ //( ( JavascriptExecutor ) driver ).executeScript( "$(document.getElementById('adminRoles')).val" + // "('DemoAdminUsers');" ); driver.findElement(By.id(GlobalIds.ASSIGN_NEW_ADMIN_ROLE)).sendKeys(TEST_ADMIN_ROLE_NAME); driver.findElement(By.id(GlobalIds.BEGIN_TIME_ARC)).clear(); driver.findElement(By.id(GlobalIds.BEGIN_TIME_ARC)).sendKeys("8:00 AM"); driver.findElement(By.id(GlobalIds.END_TIME_ARC)).clear(); driver.findElement(By.id(GlobalIds.END_TIME_ARC)).sendKeys("5:00 PM"); driver.findElement(By.id(GlobalIds.BEGIN_DATE_ARC)).clear(); driver.findElement(By.id(GlobalIds.BEGIN_DATE_ARC)).sendKeys("1/1/2013"); driver.findElement(By.id(GlobalIds.END_DATE_ARC)).clear(); driver.findElement(By.id(GlobalIds.END_DATE_ARC)).sendKeys("1/1/2099"); driver.findElement(By.id(GlobalIds.BEGIN_LOCK_DATE_ARC)).clear(); driver.findElement(By.id(GlobalIds.BEGIN_LOCK_DATE_ARC)).sendKeys("6/1/2013"); driver.findElement(By.id(GlobalIds.END_LOCK_DATE_ARC)).clear(); driver.findElement(By.id(GlobalIds.END_LOCK_DATE_ARC)).sendKeys("6/15/2013"); driver.findElement(By.id(GlobalIds.TIMEOUT_ARC)).clear(); driver.findElement(By.id(GlobalIds.TIMEOUT_ARC)).sendKeys("180"); driver.findElement(By.id(GlobalIds.MONDAY_ARC)).click(); driver.findElement(By.id(GlobalIds.TUESDAY_ARC)).click(); driver.findElement(By.id(GlobalIds.WEDNESDAY_ARC)).click(); driver.findElement(By.id(GlobalIds.THURSDAY_ARC)).click(); driver.findElement(By.id(GlobalIds.FRIDAY_ARC)).click(); driver.findElement(By.name(GlobalIds.ASSIGN_ADMIN_ROLE)).click(); TUtils.sleep(1); driver.findElement(By.id("adminRoleAssignmentsLabel")).click(); TUtils.sleep(1); driver.findElement(By.name("adminRoles.search")).click(); TUtils.sleep(2); driver.findElement(By.linkText(">")).click(); TUtils.sleep(1); driver.findElement(By.linkText(">")).click(); TUtils.sleep(1); driver.findElement(By.linkText(GlobalIds.SELECT)).click(); TUtils.sleep(2); driver.findElement(By.name(GlobalIds.ASSIGN_ADMIN_ROLE)).click(); TUtils.sleep(2); driver.findElement(By.id("contactInformationLabel")).click(); TUtils.sleep(1); driver.findElement(By.id(GlobalIds.DESCRIPTION)).clear(); driver.findElement(By.id(GlobalIds.DESCRIPTION)).sendKeys("Selenium Test User"); driver.findElement(By.id(GlobalIds.EMPLOYEE_TYPE)).clear(); driver.findElement(By.id(GlobalIds.EMPLOYEE_TYPE)).sendKeys("Test User"); driver.findElement(By.id(GlobalIds.TITLE)).clear(); TUtils.sleep(1); driver.findElement(By.id(GlobalIds.TITLE)).sendKeys("TestUser"); // TODO: Fixme. The chrome driver.findElement( By.id( ) ).sendKeys can't find focus.... if (!driverType.equals(DriverType.CHROME)) { ((JavascriptExecutor) driver).executeScript("$(document.getElementById('emails')).show();"); TUtils.sleep(1); driver.findElement(By.id(GlobalIds.EMAILS)).click(); driver.findElement(By.id(GlobalIds.EMAILS)).clear(); TUtils.sleep(1); driver.findElement(By.id(GlobalIds.EMAILS)).sendKeys("joeuser@selenium.com"); TUtils.sleep(1); ((JavascriptExecutor) driver).executeScript("$(document.getElementById('phones')).show();"); driver.findElement(By.id(GlobalIds.PHONES)).clear(); TUtils.sleep(1); driver.findElement(By.id(GlobalIds.PHONES)).sendKeys("555-555-5555"); ((JavascriptExecutor) driver).executeScript("$(document.getElementById('mobiles')).show();"); driver.findElement(By.id(GlobalIds.MOBILES)).clear(); driver.findElement(By.id(GlobalIds.MOBILES)).sendKeys("222-222-2222"); driver.findElement(By.id(GlobalIds.ADDRESS_ASSIGNMENTS_LABEL)).click(); TUtils.sleep(1); ((JavascriptExecutor) driver).executeScript("$(document.getElementById('addresses')).show();"); driver.findElement(By.id(GlobalIds.ADDRESSES)).click(); driver.findElement(By.id(GlobalIds.ADDRESSES)).clear(); driver.findElement(By.id(GlobalIds.ADDRESSES)).sendKeys("9 Manor Road"); driver.findElement(By.id(GlobalIds.ADDRESS_CITY)).clear(); driver.findElement(By.id(GlobalIds.ADDRESS_CITY)).sendKeys("Salina"); driver.findElement(By.id(GlobalIds.ADDRESS_STATE)).clear(); driver.findElement(By.id(GlobalIds.ADDRESS_STATE)).sendKeys("KS"); driver.findElement(By.id(GlobalIds.ADDRESS_COUNTRY)).clear(); driver.findElement(By.id(GlobalIds.ADDRESS_COUNTRY)).sendKeys("US"); driver.findElement(By.id(GlobalIds.ADDRESS_POSTAL_CODE)).clear(); driver.findElement(By.id(GlobalIds.ADDRESS_POSTAL_CODE)).sendKeys("67401"); driver.findElement(By.id(GlobalIds.ADDRESS_POST_OFFICE_BOX)).clear(); driver.findElement(By.id(GlobalIds.ADDRESS_POST_OFFICE_BOX)).sendKeys("422"); driver.findElement(By.id(GlobalIds.ADDRESS_BUILDING)).clear(); driver.findElement(By.id(GlobalIds.ADDRESS_BUILDING)).sendKeys("2929"); driver.findElement(By.id(GlobalIds.ADDRESS_DEPARTMENT_NUMBER)).clear(); driver.findElement(By.id(GlobalIds.ADDRESS_DEPARTMENT_NUMBER)).sendKeys("2222"); driver.findElement(By.id(GlobalIds.ADDRESS_ROOM_NUMBER)).clear(); driver.findElement(By.id(GlobalIds.ADDRESS_ROOM_NUMBER)).sendKeys("555"); } driver.findElement(By.id(GlobalIds.TEMPORAL_CONSTRAINTS_LABEL)).click(); TUtils.sleep(1); driver.findElement(By.id(GlobalIds.BEGIN_TIME_P)).clear(); driver.findElement(By.id(GlobalIds.BEGIN_TIME_P)).sendKeys("8:00 AM"); driver.findElement(By.id(GlobalIds.END_TIME_P)).clear(); driver.findElement(By.id(GlobalIds.END_TIME_P)).sendKeys("5:00 PM"); driver.findElement(By.id(GlobalIds.BEGIN_DATE_P)).clear(); driver.findElement(By.id(GlobalIds.BEGIN_DATE_P)).sendKeys("1/1/2013"); driver.findElement(By.id(GlobalIds.END_DATE_P)).clear(); driver.findElement(By.id(GlobalIds.END_DATE_P)).sendKeys("1/1/2099"); driver.findElement(By.id(GlobalIds.BEGIN_LOCK_DATE_P)).clear(); driver.findElement(By.id(GlobalIds.BEGIN_LOCK_DATE_P)).sendKeys("6/1/2013"); driver.findElement(By.id(GlobalIds.END_LOCK_DATE_P)).clear(); driver.findElement(By.id(GlobalIds.END_LOCK_DATE_P)).sendKeys("6/15/2013"); driver.findElement(By.id(GlobalIds.TIMEOUT_P)).clear(); driver.findElement(By.id(GlobalIds.TIMEOUT_P)).sendKeys("0"); driver.findElement(By.id(GlobalIds.SUNDAY_P)).click(); driver.findElement(By.id(GlobalIds.MONDAY_P)).click(); driver.findElement(By.id(GlobalIds.TUESDAY_P)).click(); driver.findElement(By.id(GlobalIds.WEDNESDAY_P)).click(); driver.findElement(By.id(GlobalIds.THURSDAY_P)).click(); driver.findElement(By.id(GlobalIds.FRIDAY_P)).click(); driver.findElement(By.id(GlobalIds.SATURDAY_P)).click(); driver.findElement(By.id(GlobalIds.SYSTEM_INFO_LABEL)).click(); TUtils.sleep(1); driver.findElement(By.id(GlobalIds.SYSTEM)).click(); driver.findElement(By.id(GlobalIds.CN)).clear(); driver.findElement(By.id(GlobalIds.CN)).sendKeys("Firstname Lastname"); driver.findElement(By.id(GlobalIds.SN)).clear(); driver.findElement(By.id(GlobalIds.SN)).sendKeys("Lastname"); driver.findElement(By.id(GlobalIds.IMPORT_PHOTO_LABEL)).click(); TUtils.sleep(1); WebElement element = driver.findElement(By.name("upload")); LocalFileDetector detector = new LocalFileDetector(); String path = "./src/test/resources/p1.jpeg"; File f = detector.getLocalFile(path); element.sendKeys(f.getAbsolutePath()); driver.findElement(By.name(GlobalIds.SAVE)).click(); TUtils.sleep(3); driver.findElement(By.name(GlobalIds.COMMIT)).click(); TUtils.sleep(1); driver.findElement(By.id(GlobalIds.IMPORT_PHOTO_LABEL)).click(); TUtils.sleep(2); driver.findElement(By.name(GlobalIds.DELETE)).click(); TUtils.sleep(1); driver.findElement(By.id(GlobalIds.SYSTEM_INFO_LABEL)).click(); driver.findElement(By.id(GlobalIds.SYSTEM)).click(); driver.findElement(By.name(GlobalIds.COMMIT)).click(); TUtils.sleep(1); driver.findElement(By.name(GlobalIds.DELETE)).click(); TUtils.sleep(1); }