Software
Software
Retrieves all
cookies in Set<Cookie> cookies =
manage().getCookies()
the current driver.manage().getCookies();
session.
Adds a new
manage().addCookie(Cookie driver.manage().addCookie(new
cookie to
cookie) Cookie("key", "value"));
the browser.
Deletes a
manage().deleteCookieNamed(S specific driver.manage().deleteCookieNamed("
tring name) cookie by key");
name.
Deletes all
manage().deleteAllCookies() driver.manage().deleteAllCookies();
cookies.
Returns a set of
Set<String> handles =
getWindowHandles() handles for all open
driver.getWindowHandles();
browser windows.
Switches to a specific
switchTo().window(String
browser window driver.switchTo().window(handle);
handle)
using its handle.
Sets a
global
wait
time
manage().timeouts( driver.manage().timeouts().implicitlyWait(10,
for
).implicitlyWait() TimeUnit.SECONDS);
locatin
g
eleme
nts.
Waits
for
specifi
c
new WebDriverWait(driver,
Explicit Wait (via conditi
Duration.ofSeconds(10)).until(ExpectedConditions.visibi
WebDriverWait) ons to
lityOfElementLocated(By.id("elementId")));
be met
before
procee
ding.
Alert alert =
switchTo().alert() Switches the context to the alert.
driver.switchTo().alert();
WebElement element =
findElement(By Locates a single web
driver.findElement(By.id("username"))
locator) element on the page.
;