Escolar Documentos
Profissional Documentos
Cultura Documentos
2º semestre de 2019
Estudante:
___________________________________________________________________________________
Lista de Exercícios
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Exercício 15</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="wrapper">
<div class="container">
<form action="">
<h1>
<i class="fas fa-shipping-fast"></i> Detalhes do Envio
</h1>
<div class="name">
<div>
<label for="f-name">Nome</label>
<input type="text" name="f-name">
</div>
<div>
<label for="l-name">Sobrenome</label>
<input type="text" name="l-name">
</div>
</div>
<div class="street">
<label for="name">Rua</label>
<input type="text" name="address">
</div>
<div class="address-info">
<div>
<label for="city">Cidade</label>
<input type="text" name="city">
</div>
<div>
<label for="state">Estado</label>
<input type="text" name="state">
</div>
<div>
<label for="zip">CEP</label>
<input type="text" name="zip">
</div>
</div>
<h1>
<i class="far fa-credit-card"></i> Informação de Pagamento
</h1>
<div class="cc-num">
<label for="card-num">No. do Cartão de Crédito</label>
<input type="text" name="card-num">
</div>
<div>
<label for="card-num">CCV</label>
<input class="ccv" type="text">
</div>
<div class="cc-info">
<fieldset>
<div>
<label for="card-num">Vencimento</label>
</div>
<div>
<label for="card-num">Mês</label>
<select id="exp">
<option>...</option>
<option>Jan</option>
<option>Fev</option>
<option>Mar</option>
<option>Abr</option>
<option>Mai</option>
<option>Jun</option>
<option>Jul</option>
<option>Ago</option>
<option>Set</option>
<option>Out</option>
<option>Nov</option>
<option>Dez</option>
</select>
</div>
<div>
<label for="card-num">Ano</label>
<select id="year">
<option>...</option>
<option>2016</option>
<option>2017</option>
<option>2018</option>
<option>2019</option>
<option>2020</option>
<option>2021</option>
<option>2022</option>
<option>2023</option>
<option>2024</option>
<option>2025</option>
</select>
</div>
</fieldset>
</div>
<div class="btns">
<button>Comprar</button>
</div>
</form>
</div>
</div>
</body>
</html>
Figura:
Classe de teste:
public class Ex15Test {
@Before
public void setUp() {
System.setProperty("webdriver.gecko.driver", "C:\\geckodriver.exe");
driver = new FirefoxDriver();
}
@After
public void tearDown() {
driver.quit();
}
@Test
public void testHTML() {
driver.get("https://lista2.adamshuk.repl.co/");
driver.findElement(By.name("f-name")).sendKeys("João");//nome
________________________________________________//sobrenome
________________________________________________ //rua
_________________________________________________//cidade
________________________________________________ //estado
________________________________________________//CEP
________________________________________________//cartao
driver.findElement(By.className("_______________")).sendKeys("150");//ccv
Select mes = new Select(driver.findElement(By.id("_______________")));//mes
mes.selectByVisibleText("Nov");
Select ano = new Select(driver.findElement(By.id("________________")));//ano
____________________("2020");
driver.findElement(_______________("button")).click();//botão
}
@Test
public void testCSS() throws InterruptedException {
driver.get("https://lista2.adamshuk.repl.co/");
driver.findElement(By.cssSelector("input[name='f-name']")).sendKeys("João");//nome
___________________________________________________________//sobrenome
__________________________________________________________________//rua
_______________________________________________________________//cidade
_______________________________________________________________//estado
________________________________________________________________//CEP
_______________________________________________________________//cartao
driver.findElement(By.cssSelector("_________")).sendKeys("150");//ccv
Select mes = new Select(driver.findElement(By.cssSelector("______________")));//mes
mes.selectByVisibleText("Nov");
Select ano = new Select(driver.findElement(By.cssSelector("_______________")));//ano
____________________("2020");
driver.findElement(By.cssSelector("____________")).click();//botão
}
@Test
public void testXpath() throws InterruptedException {
driver.get("https://lista2.adamshuk.repl.co/");
driver.findElement(By.xpath("//input[@name='f-name']")).sendKeys("João");//nome
______________________________________________________________//sobrenome
______________________________________________________________//rua
______________________________________________________________//cidade
______________________________________________________________//estado
______________________________________________________________//CEP
______________________________________________________________//cartao
driver.findElement(By.xpath("//input[@________='ccv']")).sendKeys("150");//ccv
driver.findElement(By.xpath("________________")).click();//mes
driver.findElement(By.xpath("________________")).click();//ano
driver.findElement(By.xpath("________________")).click();//botão
}
}