Codota Logo
WebDriver.close
Code IndexAdd Codota to your IDE (free)

How to use
close
method
in
org.openqa.selenium.WebDriver

Best Java code snippets using org.openqa.selenium.WebDriver.close (Showing top 20 results out of 693)

  • Common ways to obtain WebDriver
private void myMethod () {
WebDriver w =
  • Codota Iconnew FirefoxDriver()
  • Codota Iconnew ChromeDriver()
  • Codota IconCapabilities capabilities;new ChromeDriver(capabilities)
  • Smart code suggestions by Codota
}
origin: stackoverflow.com

File scrFile = ( (TakesScreenshot) driver ).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File(RESULT_FILENAME));
driver.close();
p.destroy();
origin: selenide/selenide

private void closeNewWindows(WebDriver webDriver, String currentWindowHandle, Set<String> currentWindows) {
 Set<String> windowHandles = webDriver.getWindowHandles();
 if (windowHandles.size() != currentWindows.size()) {
  Set<String> newWindows = new HashSet<>(windowHandles);
  newWindows.removeAll(currentWindows);
  log.info("File has been opened in a new window, let's close " + newWindows.size() + " new windows");
  for (String newWindow : newWindows) {
   log.info("  Let's close " + newWindow);
   try {
    webDriver.switchTo().window(newWindow);
    webDriver.close();
   }
   catch (NoSuchWindowException windowHasBeenClosedMeanwhile) {
    log.info("  Failed to close " + newWindow + ": " + Cleanup.of.webdriverExceptionMessage(windowHasBeenClosedMeanwhile));
   }
   catch (Exception e) {
    log.warning("  Failed to close " + newWindow + ": " + e);
   }
  }
  webDriver.switchTo().window(currentWindowHandle);
 }
}
origin: spring-io/initializr

@AfterEach
public void destroy() {
  if (this.driver != null) {
    this.driver.close();
  }
}
origin: TEAMMATES/teammates

/**
 * Closes the current browser window and switches back to the last window used previously.
 */
public void closeCurrentWindowAndSwitchToParentWindow() {
  driver.close();
  driver.switchTo().window(windowHandles.pop());
}
origin: org.finra.jtaf/jtaf-extwebdriver

@Override
public void closeCurrentBrowser() {
  wd.close();
  lastSelectedFrame = null;
}
origin: org.seleniumhq.webdriver/webdriver-selenium

/**
 * Simulates the user clicking the "close" button in the titlebar of a popup
 * window or tab.
 */
public void close() {
 driver.close();
}
origin: com.github.bordertech.wcomponents/wcomponents-test-lib

/**
 * {@inheritDoc}.
 */
@Override
public void close() {
  driver.close();
}
origin: com.wso2telco.test/uitest-framework

@Override
public void close() {
  // TODO Auto-generated method stub
  driver.close();
}
origin: org.paxml/PaxmlSelenium

public static void closeSessions(boolean force) {
  List<WebDriverWrapper> list = getWebDrivers();
  for (int i = list.size() - 1; i >= 0; i--) {
    WebDriverWrapper wp = list.get(i);
    if (force || !wp.keepOnError) {
      wp.webDriver.close();
    }
    list.remove(i);
  }
}
origin: org.seleniumhq.selenium.server/selenium-server-coreless

public ResultType call() throws Exception {
 WebDriver driver = getDriver();
 driver.close();
 return ResultType.SUCCESS;
}

origin: com.github.bordertech.webfriends/webfriends-selenium

/**
 * Close the current window.
 */
public void close() {
  getWebDriver().close();
}
origin: gradle.plugin.GoBqa/gradle-plugin

public static void StopService() throws InterruptedException {
  if (webdriver != null) {
    // long millisecs=10000;
    // Thread.sleep(millisecs);
    webdriver.close();
    webdriver.quit();
  }
  webdriver = null;
}
origin: net.thucydides/thucydides-core

private void closeSafely(WebDriver driver) {
  try {
    driver.close();
    driver.quit();
  } catch(Throwable ignored) {}
}
origin: net.serenity-bdd/core

private void closeSafely(WebDriver driver) {
  try {
    driver.close();
    driver.quit();
  } catch(Throwable ignored) {}
}
origin: org.teavm/teavm-junit

@Override
public void afterThread() {
  webDriver.get().close();
  webDriver.get().quit();
  webDriver.remove();
}
origin: org.rapidpm/testbench-ng-m-webdriver

 @Override
 public void afterEach(ExtensionContext context) throws Exception {
  logger().info("afterEach  -> will close and remove the webdriver now..");
  webdriver()
    .apply(context)
    .close();
  removeWebDriver().accept(context);
 }
}
origin: com.github.webdriverextensions/webdriverextensions

public static void executeForLink(WebElement link, Runnable function) {
  // Open link in new tab and execute code when in this tab
  String oldWindowHandle = openInNewTabAndFocus(link);
  function.run();
  driver().close();
  driver().switchTo().window(oldWindowHandle);
}
origin: GluuFederation/oxAuth

private void stopWebDriver(boolean useNewDriver, WebDriver currentDriver) {
  if (useNewDriver) {
    currentDriver.close();
    currentDriver.quit();
  } else {
    stopSelenium();
  }
}
origin: net.thucydides/thucydides-core

public void close() {
  if (proxyInstanciated()) {
    //if there is only one window closing it means quitting the web driver
    if (getDriverInstance().getWindowHandles() != null && getDriverInstance().getWindowHandles().size() == 1){
      this.quit();
    } else{
      getDriverInstance().close();
    }
    webDriverFactory.shutdownFixtureServices();
  }
}
origin: net.serenity-bdd/core

public void close() {
  if (proxyInstanciated()) {
    //if there is only one window closing it means quitting the web driver
    if (getDriverInstance().getWindowHandles() != null && getDriverInstance().getWindowHandles().size() == 1){
      this.quit();
    } else{
      getDriverInstance().close();
    }
    webDriverFactory.shutdownFixtureServices();
  }
}
org.openqa.seleniumWebDriverclose

Javadoc

Close the current window, quitting the browser if it's the last window currently open.

Popular methods of WebDriver

  • findElement
    Find the first WebElement using the given method. This method is affected by the 'implicit wait' tim
  • get
    Load a new web page in the current browser window. This is done using an HTTP GET operation, and the
  • manage
    Gets the Option interface
  • quit
    Quits this driver, closing every associated window.
  • findElements
    Find all elements within the current page using the given mechanism. This method is affected by the
  • getCurrentUrl
    Get a string representing the current URL that the browser is looking at.
  • switchTo
    Send future commands to a different frame or window.
  • getPageSource
    Get the source of the last loaded page. If the page has been modified after loading (for example, by
  • getTitle
    The title of the current page.
  • navigate
    An abstraction allowing the driver to access the browser's history and to navigate to a given URL.
  • getWindowHandles
    Return a set of window handles which can be used to iterate over all open windows of this WebDriver
  • getWindowHandle
    Return an opaque handle to this window that uniquely identifies it within this driver instance. This
  • getWindowHandles,
  • getWindowHandle,
  • <init>,
  • Close,
  • find_element,
  • findelement,
  • load,
  • navigateTo,
  • toString

Popular in Java

  • Running tasks concurrently on multiple threads
  • scheduleAtFixedRate (Timer)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Vector (java.util)
    The Vector class implements a growable array of objects. Like an array, it contains components that
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now