Advertisement
bizholix

finalni helper

Apr 9th, 2019
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.73 KB | None | 0 0
  1. package helpers;
  2.  
  3. import org.openqa.selenium.By;
  4. import org.openqa.selenium.WebDriver;
  5. import org.openqa.selenium.interactions.Actions;
  6.  
  7. public class AutomationHelper {
  8.  
  9. public static String mynewURL = "http://automationpractice.com";
  10. public static String movetoDRESSES = "DRESSES";
  11. public static String movetoCASUAL = "Casual Dresses";
  12. public static String dress = "//*[@id=\"center_column\"]/ul/li/div/div[1]/div/a[1]/img";
  13. public static String addtocart = "Submit";
  14. public static String checkout = ".//a[contains(@title,'Proceed to checkout')]";
  15. public static String login = "login";
  16. public static String email = "//input[@id='email']";
  17. public static String pwr = "//input[@id='passwd']";
  18. public static String Signin = "//button[@id='SubmitLogin']";
  19. public static String msg = "//textarea[@name='message']";
  20. public static String napred = "processAddress";
  21. public static String checkbox = "cgv";
  22. public static String finish = "//button[@name='processCarrier']";
  23. public static String pay = "//a[@title='Pay by check.']";
  24. public static String confirm = "//p[@id='cart_navigation']//button[@type='submit']";
  25. public static String goproceed = "Proceed to checkout";
  26. public static String navigate = "http://automationpractice.com/index.php?controller=order";
  27. public static String username = "mahadeva17@hotmail.com";
  28. public static String password = "sifra123";
  29. public static String text = "Test za polaganje Automationa";
  30.  
  31. public void TestJedann(WebDriver driver){
  32. Actions actions = new Actions(driver);
  33.  
  34.  
  35.  
  36. driver.get(mynewURL); // navigacija na stranicu
  37. driver.findElement(By.className(login)).click(); // klik na Sign in dugme
  38. driver.findElement(By.xpath(email)).sendKeys(username); // unosenje email-a
  39. driver.findElement(By.xpath(pwr)).sendKeys(password); // unosenje passworda
  40. driver.findElement(By.xpath(Signin)).click(); // klik na login dugme
  41. driver.findElement(By.linkText(movetoDRESSES)).click(); // klik na haljine
  42. driver.findElement(By.linkText(movetoCASUAL)).click(); // klik na casual haljine
  43. driver.findElement(By.xpath(dress)); //klik na quick view na sliku haljine
  44. driver.findElement(By.name(addtocart)).click(); // klik na Add to Cart
  45. actions.moveToElement(driver.findElement(By.xpath(checkout))).click().build().perform(); // klik na checkout
  46. driver.navigate().to(navigate); // mora navigacija jer element ne postoji za kliktanje
  47. driver.findElement(By.linkText(goproceed)).click(); // nastavljamo sa kliktanjem
  48. driver.findElement(By.xpath(msg)).sendKeys(text); // pisemo opciono tekst
  49. driver.findElement(By.name(napred)).click(); // klikcemo continue
  50. driver.findElement(By.id(checkbox)).click(); // checkiramo box
  51. driver.findElement(By.xpath(finish)).click(); // klikcemo continue
  52. driver.findElement(By.xpath(AutomationHelper.pay)).click(); // izaberemo nacin placanja
  53. driver.findElement(By.xpath(confirm)).click(); // zavrsavamo kupovinu
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60. }
  61.  
  62.  
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement