WebDriver & WebElements Methods Introduction |

Опубликовано: 29 Март 2025
на канале: Code Peddi
2
1

WebDriver Methods 🚗💻
WebDriver is your automated browser driver for interacting with web pages. It allows you to perform browser operations programmatically.

get(url) 🌐: Navigates to the specified URL.

getTitle() 🏷️: Retrieves the title of the current page (useful for SEO checks).

getCurrentUrl() 🔗: Gets the current page’s URL.

getPageSource() 📄: Gets the HTML source code of the current page.

getWindowHandle() 🪟: Returns the unique identifier of the current window.

close() ❌: Closes the current browser window.

quit() 🚪: Closes all browser windows and ends the WebDriver session.

navigate() 🧭: Provides methods for browser navigation (back, forward, refresh).

getScreenshotAs() 📸: Takes a screenshot of the current page.

manage() 🔧: Used for managing timeouts, cookies, and other browser settings.

WebElement Methods 🔲💡
Once you’ve located an element on the page, WebElement methods let you interact with it.

findElement() 🔍: Finds a single element on the page.

findElements() 🔎: Finds a list of elements on the page.

click() ✨: Clicks on the WebElement (e.g., button, link).

sendKeys() ⌨️: Types text into a form field or text box.

getText() 📝: Retrieves the visible text of an element.

getAttribute(attribute) 🏷️: Fetches the value of an element's attribute (e.g., href, src, alt).

getCssValue(property) 🎨: Gets the value of a specified CSS property of an element.

clear() 🧹: Clears the text input in a text box or form field.

isDisplayed() 👀: Checks if the element is visible on the page.

isEnabled() ✅: Checks if the element is enabled (clickable).

isSelected() 🏁: Checks if a checkbox or radio button is selected.






#codepeddi


Tags:
Code peddi,codepeddi,peddi code,WebDriver & WebElements Methods,findElement,findElements,get,getTitle,getCurrentUrl,getWindowHandles,getWindowHandle,close,quit,navigate,navigateBack,navigateForward,manage,addCookie,switchTo,switchToAlert,switchToFrame,getAttribute,isDisplayed,isEnabled,isSelected,clear,sendKeys,click,getSize,getText,findElementByXpath,findElementByClassName,findElementById,findElementByName,findElementByLinkText,findElementByPartialLinkText,findElementByTagName