Package org.openqa.selenium

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


            driver.switchTo().window(handle);
            String url = driver.getCurrentUrl();
            String title = driver.getTitle();
            message = formatUrlAndTitle(url, title);
            origin = getOrigin(url);
            for (Cookie cookie : driver.manage().getCookies())
                cookieMap.add(cookie);
        } catch (NotFoundException e) {
            message = "No focused window/frame.";
            origin = "";
        } catch (UnhandledAlertException e) {
View Full Code Here


public class ResizeBrowser {

  public static void main(String[] args) {
    WebDriver dr = new ChromeDriver();
    dr.manage().window().setSize(new Dimension(240, 320));
    dr.get("http://www.3g.qq.com/");
    dr.quit();
  }

}
View Full Code Here

    System.out.printf("now accesss %s \n", url);
   
    dr.get(url);
    Thread.sleep(2000);
   
    System.out.println(dr.manage().getCookies());
   
    dr.manage().deleteAllCookies();
   
    Cookie c1 = new Cookie("BAIDUID", "xxxxxxxxxx");
    Cookie c2 = new Cookie("BDUSS", "xxxxxxxxxx");
View Full Code Here

    dr.get(url);
    Thread.sleep(2000);
   
    System.out.println(dr.manage().getCookies());
   
    dr.manage().deleteAllCookies();
   
    Cookie c1 = new Cookie("BAIDUID", "xxxxxxxxxx");
    Cookie c2 = new Cookie("BDUSS", "xxxxxxxxxx");
    dr.manage().addCookie(c1);
    dr.manage().addCookie(c2);
View Full Code Here

   
    dr.manage().deleteAllCookies();
   
    Cookie c1 = new Cookie("BAIDUID", "xxxxxxxxxx");
    Cookie c2 = new Cookie("BDUSS", "xxxxxxxxxx");
    dr.manage().addCookie(c1);
    dr.manage().addCookie(c2);
   
    System.out.println("browser will be close");
   
    dr.quit()
View Full Code Here

    dr.manage().deleteAllCookies();
   
    Cookie c1 = new Cookie("BAIDUID", "xxxxxxxxxx");
    Cookie c2 = new Cookie("BDUSS", "xxxxxxxxxx");
    dr.manage().addCookie(c1);
    dr.manage().addCookie(c2);
   
    System.out.println("browser will be close");
   
    dr.quit()
  }
View Full Code Here

  public static void main(String[] args) throws InterruptedException {
    WebDriver dr = new ChromeDriver();
    Thread.sleep(2000);
   
    System.out.println("maximize browser");
    dr.manage().window().maximize();
    Thread.sleep(2000);
   
    System.out.println("browser will be close");
    dr.quit()
  }
View Full Code Here

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

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

    @Test
    public void shouldNotSeeCookieFromDifferentDomain() {
        WebDriver webDriver = new JerseyClientHtmlunitDriver(client);
        webDriver.get("http://localhost");
        webDriver.manage().addCookie(new Cookie("cookieone", "valueone", "localhost", "/", null));
        webDriver.get("http://thoughtworks");
        assertThat(webDriver.getTitle(), is("Status"));
        assertThat(webDriver.findElement(By.id("cookie_header.value")).getText(), is(""));
    }
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.