Demo Selenium Easy

Share

Demo Selenium Easy

I can provide you with a simple example of using Selenium WebDriver with Java to automate a basic task on the “Selenium Easy” website. In this example, we’ll automate the process of filling out a form.

  1. First, make sure you have Selenium WebDriver set up in your Java project. You can download the Selenium WebDriver Java bindings and add them to your project’s dependencies.

  2. Create a Java class for your Selenium test, and import the necessary libraries:

java
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class SeleniumEasyDemo { public static void main(String[] args) { // Set the path to the ChromeDriver executable System.setProperty("webdriver.chrome.driver", "path_to_chromedriver/chromedriver.exe"); // Initialize the WebDriver WebDriver driver = new ChromeDriver(); // Open the Selenium Easy website driver.get("https://www.seleniumeasy.com/test/basic-first-form-demo.html"); // Find the "Enter a message" input field by its name WebElement messageInput = driver.findElement(By.name("message")); // Enter a message into the input field messageInput.sendKeys("Hello, Selenium Easy!"); // Find the "Show Message" button by its xpath WebElement showMessageButton = driver.findElement(By.xpath("//button[contains(text(),'Show Message')]")); // Click the "Show Message" button showMessageButton.click(); // Find the element that displays the entered message WebElement messageDisplay = driver.findElement(By.id("display")); // Get and print the displayed message String displayedMessage = messageDisplay.getText(); System.out.println("Displayed Message: " + displayedMessage); // Close the browser driver.quit(); } }
  1. Replace "path_to_chromedriver/chromedriver.exe" with the actual path to the ChromeDriver executable on your system.

  2. Run the Java class, and it will open a Chrome browser, navigate to the “Selenium Easy” website, fill out the form, click the button, and display the entered message.

Make sure you have the Chrome browser and ChromeDriver installed on your system for this example to work. You can adapt this example to automate other tasks on the Selenium Easy website or any other website by modifying the element locators and actions as needed.

Demo Day 1 Video:

 
You can find more information about Selenium in this Selenium Link

 

Conclusion:

Unogeeks is the No.1 IT Training Institute for Selenium Training. Anyone Disagree? Please drop in a comment

You can check out our other latest blogs on  Selenium here – Selenium Blogs

You can check out our Best In Class Selenium Training Details here – Selenium Training

💬 Follow & Connect with us:

———————————-

For Training inquiries:

Call/Whatsapp: +91 73960 33555

Mail us at: info@unogeeks.com

Our Website ➜ https://unogeeks.com

Follow us:

Instagram: https://www.instagram.com/unogeeks

Facebook:https://www.facebook.com/UnogeeksSoftwareTrainingInstitute

Twitter: https://twitter.com/unogeeks


Share

Leave a Reply

Your email address will not be published. Required fields are marked *