Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.openqa.selenium.By;
- import org.openqa.selenium.Dimension;
- import org.openqa.selenium.WebDriver;
- import org.openqa.selenium.WebElement;
- import org.openqa.selenium.chrome.ChromeDriver;
- import java.util.ArrayList;
- import java.util.Map;
- public class Programa
- {
- public static void main(String[] args) //throws InterruptedException
- {
- System.setProperty("webdriver.chrome.driver","C:\\chromedriver.exe");
- WebDriver driver = new ChromeDriver();
- String bazineNuoroda = "http://demo.guru99.com/test/newtours/";
- driver.get(bazineNuoroda);
- // WebElement meniuMygtukasBankProject = driver.findElement(By.linkText("Bank Project"));
- // meniuMygtukasBankProject.click();
- driver.findElement(By.linkText("Bank Project")).click();
- WebElement idError = driver.findElement(By.id("message23"));
- WebElement pswError = driver.findElement(By.id("message18"));
- WebElement idTextField = driver.findElement(By.name("uid"));
- WebElement pswTextField = driver.findElement(By.name("password"));
- idTextField.sendKeys("blbalbalbal");
- pswTextField.sendKeys("value", "fffffffffffffffff");
- // driver.findElement(By.name("uid")).click();
- // driver.findElement(By.name("password")).click();
- // driver.findElement(By.tagName("body")).click();
- if (idError.getText().equals("User-ID must not be blank"))
- {
- System.out.println("ID kai neįvestas, išveda errorą viskas gerai");
- }
- else
- {
- System.out.println("ID kai neįvestas, erroro neišveda. BLOGAI!");
- }
- if (pswError.getText().equals("Password must not be blank"))
- {
- System.out.println("PSW kai neįvestas, išveda errorą viskas gerai");
- }
- else
- {
- System.out.println("PSW kai neįvestas, erroro neišveda. BLOGAI!");
- }
- }
- public static void patikrintiArLentelesPlotisKeiciasi(WebDriver driver)
- {
- ArrayList<String> tableBodyPlotis = new ArrayList<>();
- WebElement visasPuslapioBody = driver.findElement(By.cssSelector("div > table > tbody"));
- WebElement visasPuslapioBody2 = driver.findElement(By.tagName("tbody"));
- System.out.println(visasPuslapioBody.getText());
- System.out.println(visasPuslapioBody2.getText());
- /* try
- {
- Thread.sleep(5000);
- }
- catch (InterruptedException e)
- {
- e.printStackTrace();
- }*/
- System.out.println(visasPuslapioBody.getCssValue("width"));
- System.out.println(visasPuslapioBody2.getCssValue("width"));
- tableBodyPlotis.add(visasPuslapioBody.getCssValue("width"));
- driver.manage().window().setSize(new Dimension(1000, 1000));
- tableBodyPlotis.add(visasPuslapioBody.getCssValue("width"));
- driver.manage().window().setSize(new Dimension(3000, 1000));
- tableBodyPlotis.add(visasPuslapioBody.getCssValue("width"));
- if (tableBodyPlotis.get(0).equals(tableBodyPlotis.get(1)))
- {
- System.out.println("Lentelės plotis nepakito pakeitus naršyklės plotį į 1000px");
- }
- if (tableBodyPlotis.get(0).equals(tableBodyPlotis.get(2)))
- {
- System.out.println("Lentelės plotis nepakito pakeitus naršyklės plotį į 3000px");
- }
- System.out.println(tableBodyPlotis.toString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement