Package org.openqa.selenium

Examples of org.openqa.selenium.WebDriver.manage()


    @Test
    public void shouldNotSeeCookieForDifferentPath() {
        WebDriver webDriver = new JerseyClientHtmlunitDriver(client);
        webDriver.get("http://localhost");
        webDriver.manage().addCookie(new Cookie("cookieone", "valueone", "localhost", "/cookie", null));
        webDriver.get("http://localhost");
        assertThat(webDriver.getTitle(), is("Status"));
        assertThat(webDriver.findElement(By.id("cookie_header.value")).getText(), is(""));
    }
View Full Code Here


        DesiredCapabilities capability = DesiredCapabilities.firefox();
        capability.setCapability(CapabilityType.PROXY, proxy);

        String urlString = "http://www.yahoo.com/";
        WebDriver driver = new FirefoxDriver(capability);
        driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);

        driver.get(urlString);

        driver.close();
        System.out.println("Driver closed");
View Full Code Here

        final String urlString = "http://www.yahoo.com/";

        // Note this will actually launch a browser!!
        final WebDriver driver = new FirefoxDriver(capability);
        driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);

        driver.get(urlString);
        final String source = driver.getPageSource();

        // Just make sure it got something within reason.
View Full Code Here

        if (userIsLoggedIn != null) {
            final URI baseUri = getBaseURI(before.getTestMethod());
            final WebDriver driver = createWebDriver();
            try {
                driver.manage().deleteAllCookies();

                driver.navigate().to(baseUri + USER_LOGIN_SERVLET_PATH + "?location=" + URLEncoder.encode(userIsLoggedIn.location(), "UTF-8"));
                String loginURL = driver.findElement(By.id("login-url")).getText();

                // check
View Full Code Here

                if (loginHandler == null) {
                    loginHandler = new DefaultLoginHandler();
                }
                loginHandler.login(driver, new UserLoginContext(userIsLoggedIn));
                // copy cookies
                Set<Cookie> cookies = driver.manage().getCookies();
                for (Cookie cookie : cookies) {
                    ModulesApi.addCookie(cookie.getName(), cookie.getValue());
                }
            } finally {
                driver.close();
View Full Code Here

        open(MENUTEST_ATTACHTOBODY_APP);
        String menuItem3 = "actionItemAttachToBody3";
        WebDriver driver = this.getDriver();
        WebElement actionItem3 = driver.findElement(By.className(menuItem3));
        // Need to make the screen bigger so WebDriver doesn't need to scroll
        driver.manage().window().setSize(new Dimension(1366, 768));
        String trigger = "triggerAttachToBody";
        String menuList = "actionMenuAttachToBody";
        String triggerGlobalId = auraUITestingUtil.getCmpGlobalIdGivenElementClassName(trigger);
        String menuListGlobalId = auraUITestingUtil.getCmpGlobalIdGivenElementClassName(menuList);
        WebElement menuLabel = driver.findElement(By.className(trigger));
View Full Code Here

        String triggerLeftPosAfterClickOnItem2 = auraUITestingUtil
                .getBoundingRectPropOfElement(triggerGlobalId, "left");
        assertEquals("Menu Item position changed after clicking on Item2", triggerLeftPosBeforeClick,
                triggerLeftPosAfterClickOnItem2);

        int currentWidth = driver.manage().window().getSize().width;
        int currentHeight = driver.manage().window().getSize().height;
        driver.manage().window().setSize(new Dimension(currentWidth - 200, currentHeight - 100));
        verifyMenuPositionedCorrectly(triggerGlobalId, menuListGlobalId,
                "Menu List is not positioned correctly after the resize");
    }
View Full Code Here

                .getBoundingRectPropOfElement(triggerGlobalId, "left");
        assertEquals("Menu Item position changed after clicking on Item2", triggerLeftPosBeforeClick,
                triggerLeftPosAfterClickOnItem2);

        int currentWidth = driver.manage().window().getSize().width;
        int currentHeight = driver.manage().window().getSize().height;
        driver.manage().window().setSize(new Dimension(currentWidth - 200, currentHeight - 100));
        verifyMenuPositionedCorrectly(triggerGlobalId, menuListGlobalId,
                "Menu List is not positioned correctly after the resize");
    }
View Full Code Here

        assertEquals("Menu Item position changed after clicking on Item2", triggerLeftPosBeforeClick,
                triggerLeftPosAfterClickOnItem2);

        int currentWidth = driver.manage().window().getSize().width;
        int currentHeight = driver.manage().window().getSize().height;
        driver.manage().window().setSize(new Dimension(currentWidth - 200, currentHeight - 100));
        verifyMenuPositionedCorrectly(triggerGlobalId, menuListGlobalId,
                "Menu List is not positioned correctly after the resize");
    }

    /**
 
View Full Code Here

        WebDriver wd = mock(WebDriver.class);
        WebElement we = mock(WebElement.class);
        WebDriver.Options options = mock(WebDriver.Options.class);
        WebDriver.Timeouts timeouts = mock(WebDriver.Timeouts.class);

        when(wd.manage()).thenReturn(options);
        when(options.timeouts()).thenReturn(timeouts);
        when(timeouts.implicitlyWait(10, TimeUnit.SECONDS)).thenReturn(timeouts);
        when(wd.findElement(By.tagName("div"))).thenReturn(we);
        when(we.getTagName()).thenReturn("div");
        when(timeouts.implicitlyWait(0, TimeUnit.SECONDS)).thenReturn(timeouts);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.