dev-resources.site
for different kinds of informations.
Selenium webDriver Cheat sheet
Published at
11/30/2024
Categories
selenium
Author
codegreen
Categories
1 categories in total
selenium
open
Author
9 person written this
codegreen
open
Selenium WebDriver Cheat Sheet
Method | Syntax | Description |
---|---|---|
Initialize WebDriver | WebDriver driver = new ChromeDriver(); |
Initializes the WebDriver for the specified browser. |
Launch URL | driver.get("http://www.example.com"); |
Navigates to the specified URL. |
Find Element | WebElement element = driver.findElement(By.id("id")); |
Locates a single WebElement using a specified selector. |
Find Elements | List<WebElement> elements = driver.findElements(By.className("class")); |
Locates multiple WebElements. |
Click Element | element.click(); |
Performs a click action on the specified WebElement. |
Send Keys | element.sendKeys("text"); |
Types text into an input field. |
Get Element Text | String text = element.getText(); |
Retrieves the visible text of a WebElement. |
Get Element Attribute | String value = element.getAttribute("attributeName"); |
Gets the value of a specified attribute of the element. |
Get Page Title | String title = driver.getTitle(); |
Retrieves the title of the current page. |
Get Current URL | String url = driver.getCurrentUrl(); |
Retrieves the URL of the current page. |
Navigate Back | driver.navigate().back(); |
Navigates back to the previous page in the browser history. |
Navigate Forward | driver.navigate().forward(); |
Navigates forward to the next page in the browser history. |
Refresh Page | driver.navigate().refresh(); |
Refreshes the current page. |
Manage Cookies | driver.manage().addCookie(new Cookie("name", "value")); |
Adds a cookie to the current session. |
Delete All Cookies | driver.manage().deleteAllCookies(); |
Deletes all cookies in the current session. |
Maximize Window | driver.manage().window().maximize(); |
Maximize the browser window. |
Set Window Size | driver.manage().window().setSize(new Dimension(width, height)); |
Set the size of the browser window. |
Switch to Frame | driver.switchTo().frame("frameName"); |
Switches the WebDriver context to the specified frame. |
Switch to Alert | Alert alert = driver.switchTo().alert(); |
Switches to an alert box. |
Accept Alert | alert.accept(); |
Accepts the currently displayed alert. |
Dismiss Alert | alert.dismiss(); |
Dismisses the currently displayed alert. |
Quit Driver | driver.quit(); |
Closes all associated windows and terminates the WebDriver session. |
selenium Article's
30 articles in total
How to solve the problem of limited access speed of crawlers
read article
Starting testing
read article
Comprehensive Guide to Waits in Selenium 4
read article
Effective Strategies for Managing Flaky Tests in Automated Test Suites
read article
Application of proxy IP in automated testing framework
read article
My First Steps with Playwright ๐ญ: A Testerโs Journey from Selenium
read article
Web/Mobile UI Test Automation Using Selenium & Appium For Food Ordering Solution
read article
Hi @All, I'm working devOps engineer in product based company and I want to is there any tool or way to get test cases from existing products as development from scratch is not possible on this stage to automate automation testing using Selenium Jenkins ?
read article
Selenium Vs. Cypress: What are the Key Differences?
read article
Improve User Experience & SEO: The Power of Automated Accessibility Testing
read article
Playwright vs Selenium WebDriver: Simplified. Which one to choose for your application automation needs?
read article
BrowserStack vs TestGrid: Which Cloud Testing Platform Suits Your Needs?
read article
Building Robust Web Automation with Selenium and Python
read article
Test Automation Frameworks- The Complete Guide
read article
The Input password field is not displaying password but mot throwing error
read article
ไฝฟ็จ selenium ่ฎๅ้่ฆ็ปๅ
ฅๆๅก็็ถฒ้
read article
Handling Dynamic Tables with Changing Rows and Columns
read article
Struggling with Selenium/WebdriverIO Updates? Letโs Break It Down Step-by-Step!
read article
Cypress vs Selenium: Which Testing Tool Is Right for You?
read article
How to Write Effective Test Cases
read article
Playwright vs Selenium: A Detailed Comparison
read article
Selenium webDriver Cheat sheet
currently reading
Selenium WebDriver steps and methods
read article
Selenium Testing: The Complete Step-by-Step Tutorial
read article
error when executing script in selenium using chromedriver
read article
Mastering Selenium C# with NUnit: In-Depth Guide to Page Object Model (POM) and Data Object Model (DOM)
read article
WebDriverIO Tutorial For Selenium Automation - A Complete Guide
read article
Selenium CAPTCHA Bypass: Tokens vs. Clicks โ Which Oneโs Faster?
read article
Cloud Test Automation with Selenium: Revolutionizing Testing for Cloud-Based Applications
read article
Why You Should Learn Automation: A Guide to Saving Time as a Developer
read article
Featured ones: