Added Manipuation hover duckduckgo
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
package com.agile611.testng.webdriver;
|
package com.agile611.testng.webdriver;
|
||||||
|
|
||||||
import org.openqa.selenium.By;
|
import org.openqa.selenium.By;
|
||||||
|
import org.openqa.selenium.WebElement;
|
||||||
|
import org.openqa.selenium.interactions.Actions;
|
||||||
|
import static org.testng.Assert.assertTrue;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class ManipulationTest extends BaseTest {
|
public class ManipulationTest extends BaseTest {
|
||||||
@@ -11,12 +14,20 @@ public class ManipulationTest extends BaseTest {
|
|||||||
driver.findElement(By.id("searchbox_input")).sendKeys("pizza hawaiana"); //Escribir en el text box
|
driver.findElement(By.id("searchbox_input")).sendKeys("pizza hawaiana"); //Escribir en el text box
|
||||||
driver.findElement(By.id("searchbox_input")).submit(); //Submit, darle al enter.
|
driver.findElement(By.id("searchbox_input")).submit(); //Submit, darle al enter.
|
||||||
Thread.sleep(2000); //Espera forzada
|
Thread.sleep(2000); //Espera forzada
|
||||||
|
WebElement resultsList = driver.findElement(By.className("react-results--main")); //Comprobar que el resultado se muestra
|
||||||
|
assertTrue(resultsList.isDisplayed());
|
||||||
|
|
||||||
|
|
||||||
driver.get("https://www.duckduckgo.com/"); //Navegar hasta duckduckgo
|
driver.get("https://www.duckduckgo.com/"); //Navegar hasta duckduckgo
|
||||||
driver.findElement(By.id("searchbox_input")).clear(); //Limpiar el text box
|
driver.findElement(By.id("searchbox_input")).clear(); //Limpiar el text box
|
||||||
driver.findElement(By.id("searchbox_input")).sendKeys("tortellini al pesto"); //Escribir en el text box
|
driver.findElement(By.id("searchbox_input")).sendKeys("tortellini al pesto");
|
||||||
driver.findElement(By.id("search_button_homepage")).click(); //click a la lupa. Va a petar porque el id del botón de búsqueda ha cambiado, pero es para mostrar la diferencia entre submit y click.
|
|
||||||
Thread.sleep(2000); //Espera forzada
|
Thread.sleep(2000); //Espera forzada
|
||||||
|
Actions builder = new Actions(driver);
|
||||||
|
WebElement searchButton = driver.findElement(By.xpath(".//button[@data-mode=\'search\']")); //Click en el text box, no hace nada pero es para mostrar la diferencia entre submit y click.
|
||||||
|
builder.moveToElement(searchButton).click().build().perform(); //Click en el botón de búsqueda, esto es diferente a submit, ya que submit solo funciona con formularios, mientras que click funciona con cualquier elemento.
|
||||||
|
Thread.sleep(2000); //Espera forzada
|
||||||
|
resultsList = driver.findElement(By.className("react-results--main")); //Comprobar que el resultado se muestra
|
||||||
|
assertTrue(resultsList.isDisplayed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user