From b7242b523e0c0ec629c027f5f8ddce2949d2643b Mon Sep 17 00:00:00 2001 From: Muthulakshmi-2511 <124550909+Muthulakshmi-2511@users.noreply.github.com> Date: Wed, 15 Feb 2023 15:40:21 +0530 Subject: [PATCH] Update CreateContact.java --- week2/day2.assignments/CreateContact.java | 74 ++++++++++------------- 1 file changed, 31 insertions(+), 43 deletions(-) diff --git a/week2/day2.assignments/CreateContact.java b/week2/day2.assignments/CreateContact.java index a2794dd..a9d2a39 100644 --- a/week2/day2.assignments/CreateContact.java +++ b/week2/day2.assignments/CreateContact.java @@ -1,53 +1,41 @@ package week2.day2.Assignments; +import org.openqa.selenium.By; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.support.ui.Select; + public class CreateContact { public static void main(String[] args) { + ChromeDriver driver= new ChromeDriver(); + driver.get("http://leaftaps.com/opentaps/control/login"); + driver.manage().window().maximize(); + driver.findElement(By.id("username")).sendKeys("Demosalesmanager"); + driver.findElement(By.id("password")).sendKeys("crmsfa"); + driver.findElement(By.className("decorativeSubmit")).click(); + driver.findElement(By.linkText("CRM/SFA")).click(); + driver.findElement(By.linkText("Contacts")).click(); + driver.findElement(By.linkText("Create Contact")).click(); + driver.findElement(By.id("firstNameField")).sendKeys("Muthu"); + driver.findElement(By.id("lastNameField")).sendKeys("Lakshmi"); + driver.findElement(By.id("createContactForm_firstNameLocal")).sendKeys("muthulakshmi"); + driver.findElement(By.id("createContactForm_lastNameLocal")).sendKeys("gfsjry"); + driver.findElement(By.id("createContactForm_departmentName")).sendKeys("Testing"); + driver.findElement(By.id("createContactForm_description")).sendKeys("Validation checked"); + driver.findElement(By.id("createContactForm_primaryEmail")).sendKeys("muthulakshmi2599@gmail.com"); + driver.findElement(By.id("createContactForm_generalStateProvinceGeoId")).click(); + Select stateDropDown=new Select(driver.findElement(By.id("createContactForm_generalStateProvinceGeoId"))); + stateDropDown.selectByVisibleText("New York"); + driver.findElement(By.name("submitButton")).click(); + driver.findElement(By.linkText("Edit")).click(); + driver.findElement(By.id("updateContactForm_description")).clear(); + driver.findElement(By.id("updateContactForm_importantNote")).sendKeys("dhwieufb"); + driver.findElement(By.xpath("//input[@name='submitButton']")).click(); + String title = driver.getTitle(); + System.out.println(title); + - /* - * //Pseudo Code - * - * 1. Launch URL "http://leaftaps.com/opentaps/control/login" - * - * 2. Enter UserName and Password Using Id Locator - * - * 3. Click on Login Button using Class Locator - * - * 4. Click on CRM/SFA Link - * - * 5. Click on contacts Button - * - * 6. Click on Create Contact - * - * 7. Enter FirstName Field Using id Locator - * - * 8. Enter LastName Field Using id Locator - * - * 9. Enter FirstName(Local) Field Using id Locator - * - * 10. Enter LastName(Local) Field Using id Locator - * - * 11. Enter Department Field Using any Locator of Your Choice - * - * 12. Enter Description Field Using any Locator of your choice - * - * 13. Enter your email in the E-mail address Field using the locator of your choice - * - * 14. Select State/Province as NewYork Using Visible Text - * - * 15. Click on Create Contact - * - * 16. Click on edit button - * - * 17. Clear the Description Field using .clear - * - * 18. Fill ImportantNote Field with Any text - * - * 19. Click on update button using Xpath locator - * - * 20. Get the Title of Resulting Page. - */ }