🎤 Intro Line:
To interact with the website named 'formy' and perform certain actions we can follow the below code:
Code:
import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class FormyAutomation { WebDriver driver; public static void main(String[] args) { // Creare driver using WebDriverManager WebDriverManager.chromedriver().timeout(30).setup(); driver = new ChromeDriver(); // Navigate to the formy website driver.get(""); // Find and fill in the details WebElement nameField = driver.findElement(By.id("name")); nameField.sendKeys("John Doe"); WebElement emailField = driver.findElement(By.id("email")); emailField.sendKeys("johndoe@example.com"); // Click on the submit button WebElement submitButton = driver.findElement(By.id("submit")); submitButton.click(); // Store the response String response = driver.getPageSource(); // Close the browser driver.quit(); // Return the response return response; } }