Selenium WebDriver Tutorial #16 – WebElement Methods in Selenium

In this Selenium Webdriver Tutorial we will learn about Webelement methods in Selenium Webdriver. You will learn about some of the key webelement commands/methods in Selenium Java along with examples.

Some of the key methods covered are:

✅ sendKeys(java.lang.CharSequence… keysToSend) – Use this method to simulate typing into an element, which may set its value.

✅ clear() – If this element is a text entry element, this will clear the value.

✅ click() – Click this element.

✅ getAttribute(java.lang.String name) – Get the value of the given attribute of the element.

✅ getCssValue(java.lang.String propertyName) – Get the value of a given CSS property.

✅ getLocation() – Where on the page is the top left-hand corner of the rendered element?

✅ getSize() – What is the width and height of the rendered element?

✅ getTagName() – Get the tag name of this element.

✅ getText() – Get the visible text

✅ isDisplayed() – Is this element displayed or not? This method avoids the problem of having to parse an element’s “style” attribute.

✅ isEnabled() – Is the element currently enabled or not? This will generally return true for everything but disabled input elements.

✅ isSelected() – Determine whether or not this element is selected or not.

Selenium WebDriver Tutorial #15 – Basic Methods in WebDriver Interface – Part 2

In this Selenium Webdriver Tutorial we will learn about few more basic methods in WebDriver Interface. We will understand the basic methods along with examples and how to use those methods in Selenium Automation. Some of the methods which we will learn are:

✅ getWindowHandle(): Return an opaque handle to this window that uniquely identifies it within this driver instance.

✅ getWindowHandles(): Return a set of window handles which can be used to iterate over all open windows of this WebDriver instance by passing them to switchTo().WebDriver.Options.window()

✅ switchTo(): Send future commands to a different frame or window.

✅ findElement(By by): Find the first WebElement using the given method.

✅ findElements(By by): Find all elements within the current page using the given mechanism.

Selenium WebDriver Tutorial #14 – What are the Basic Methods in WebDriver Interface

In this Selenium Webdriver Tutorial we will learn about “What are the basic methods in WebDriver Interface. We will understand the basic methods along with examples and how to use those methods in Selenium Automation. Some of the basic WebDriver Interface methods are:

✅ get(java.lang.String url): Load a new web page in the current browser window.

✅ manage(): Gets the Option interface.

✅ getCurrentUrl(): Get a string representing the current URL that the browser is looking at.

✅ getTitle(): The title of the current page.

✅ getPageSource(): Get the source of the last loaded page.

✅ navigate(): An abstraction allowing the driver to access the browser’s history and to navigate to a given URL. ✅ quit(): Quits this driver, closing every associated window.

✅ close(): Close the current window, quitting the browser if it’s the last window currently open.

✅ getWindowHandle(): Return an opaque handle to this window that uniquely identifies it within this driver instance.

✅ getWindowHandles(): Return a set of window handles which can be used to iterate over all open windows of this WebDriver instance by passing them to switchTo().WebDriver.Options.window()

✅ switchTo(): Send future commands to a different frame or window.
✅ findElement(By by): Find the first WebElement using the given method.

✅ findElements(By by): Find all elements within the current page using the given mechanism.

Selenium WebDriver Tutorial #13 – What is Relative Locator in Selenium

In this Selenium Webdriver Tutorial we will learn about Relative locator in Selenium Webdriver. Selenium 4 introduced relative locators which were previously called as friendly locators. Relative locator help to locate elements that are nearby to other elements.

Selenium WebDriver Tutorial #12 – What are Locators in Selenium WebDriver

In this Selenium Webdriver Tutorial we will learn about what are Locators in Selenium WebDriver. There are 8 primary locator strategies to identify web elements on any web page. Along with these 8 strategies Selenium 4 brings Relative Locators strategy as well.