0% found this document useful (0 votes)
22 views1 page

WebDriver Methods

The document provides a list of common WebDriver methods used in automation testing, along with their descriptions and examples. Methods include actions like opening a URL, retrieving titles and URLs, finding elements, sending keys, clicking, and navigating. It also covers managing browser windows and switching between alerts, frames, and windows.

Uploaded by

aizas81778
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views1 page

WebDriver Methods

The document provides a list of common WebDriver methods used in automation testing, along with their descriptions and examples. Methods include actions like opening a URL, retrieving titles and URLs, finding elements, sending keys, clicking, and navigating. It also covers managing browser windows and switching between alerts, frames, and windows.

Uploaded by

aizas81778
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd

Method Name

Description Example
get(url) Opens a wedriver.get("https://google.com");
getTitle() Gets the ti String title = driver.getTitle();
getCurrentUGets the URString url = driver.getCurrentUrl();
findElemenFinds a sin driver.findElement(By.id("username"));
findElemenFinds mult List<WebElement> elements = driver.findElements(By.className("items"));
sendKeys("Sends text driver.findElement(By.name("q")).sendKeys("Selenium");
click() Clicks on a driver.findElement(By.id("login")).click();
clear() Clears the driver.findElement(By.name("password")).clear();
submit() Submits a driver.findElement(By.id("search")).submit();
getText() Gets the teString text = driver.findElement(By.tagName("h1")).getText();
isDisplayedChecks if aboolean visible = driver.findElement(By.id("logo")).isDisplayed();
isEnabled()Checks if aboolean enabled = driver.findElement(By.id("submit")).isEnabled();
isSelected(Checks if aboolean selected = driver.findElement(By.name("gender")).isSelected();
getAttributGets the vaString value = driver.findElement(By.id("email")).getAttribute("value");
getCssValuGets the CSString color = driver.findElement(By.tagName("h1")).getCssValue("color");
navigate().Navigates driver.navigate().to("https://example.com");
navigate().Goes back driver.navigate().back();
navigate().Goes forwadriver.navigate().forward();
navigate().Refreshes tdriver.navigate().refresh();
manage().wMaximizes driver.manage().window().maximize();
manage().wMinimizes driver.manage().window().minimize();
manage().tSets implicdriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
switchTo().Switches toAlert alert = driver.switchTo().alert();
switchTo() Switches todriver.switchTo().frame("frame1");
switchTo().Switches bdriver.switchTo().defaultContent();
switchTo() Switches bdriver.switchTo().window(handle);

You might also like