SHARE
TWEET

kolok

a guest Jan 27th, 2020 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. System.setProperty("webdriver.chrome.driver", "C:\\Users\\Pakisa\\Downloads\\chromedriver.exe");
  2.         WebDriver driver = new ChromeDriver();
  3.         driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
  4.  
  5.         driver.get("file:///C:\\Users\\Pakisa\\Downloads\\kolokvijum2_test\\kolokvijum2_test\\decembar\\zadaci\\zadatak4.html");
  6.        
  7.          List<WebElement> red = driver.findElements(By.tagName("tr"));
  8.         System.out.println(red.size());
  9.        
  10.         WebElement naziv = driver.findElement(By.id("naziv"));
  11.         WebElement godinaProizvodnje = driver.findElement(By.id("godinaProzivodnje"));
  12.         WebElement cena = driver.findElement(By.id("cena"));
  13.         WebElement kilometraza = driver.findElement(By.id("kilometraza"));
  14.         WebElement button = driver.findElement(By.id("button"));
  15.        
  16.         naziv.clear();
  17.         godinaProizvodnje.clear();
  18.         cena.clear();
  19.         kilometraza.clear();
  20.        
  21.         naziv.sendKeys("Ford");
  22.         godinaProizvodnje.sendKeys("2001");
  23.         cena.sendKeys("200");
  24.         kilometraza.sendKeys("12500");
  25.         button.click();
  26.         List<WebElement> red1 = driver.findElements(By.tagName("tr"));
  27.         System.out.println(red1.size());
  28.         assertEquals(4, red1.size()-1);
  29.        
  30.         //brisi
  31.         WebElement brisi = driver.findElement(By.tagName("vm.brisi(el)"));
  32.         brisi.click();
  33.         List<WebElement> red2 = driver.findElements(By.tagName("tr"));
  34.         System.out.println(red2.size());
  35.         assertEquals(3, red2.size()-1);
  36.        
  37.         //pretraga
  38.         WebElement pretraga = driver.findElement(By.id("pretraga"));
  39.         pretraga.clear();
  40.         pretraga.sendKeys("Ford");
  41.        
  42.         List<WebElement> red3 = driver.findElements(By.tagName("tr"));
  43.         System.out.println(red3.size());
  44.         assertEquals(1, red3.size()-1);
  45.        
  46.        
  47.  
  48.         //Close the browser
  49.         driver.quit();
  50.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top