Created
June 14, 2022 19:11
-
-
Save podchasova11/340f661e3e937a09c62f39f1b506bf0f to your computer and use it in GitHub Desktop.
11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package javawebui.lesson5; | |
| import io.github.bonigarcia.wdm.WebDriverManager; | |
| import org.junit.jupiter.api.*; | |
| import org.openqa.selenium.By; | |
| import org.openqa.selenium.WebDriver; | |
| import org.openqa.selenium.WebElement; | |
| import org.openqa.selenium.chrome.ChromeDriver; | |
| import org.openqa.selenium.interactions.Actions; | |
| import org.openqa.selenium.support.ui.ExpectedConditions; | |
| import org.openqa.selenium.support.ui.WebDriverWait; | |
| import java.time.Duration; | |
| import java.util.List; | |
| public class AfishaTest { | |
| WebDriver driver; | |
| WebDriverWait webDriverWait; | |
| Actions actions; | |
| private final static String AFISHA_BASE_URL = "https://afisha.ru"; | |
| @BeforeAll | |
| static void registerDriver() { | |
| WebDriverManager.chromedriver().setup(); | |
| } | |
| @BeforeEach | |
| void setupDriver() { | |
| driver = new ChromeDriver(); | |
| webDriverWait = new WebDriverWait(driver, Duration.ofSeconds(5)); | |
| actions = new Actions(driver); | |
| driver.get(AFISHA_BASE_URL); | |
| } | |
| @Test | |
| void hoverItemTest() { | |
| actions.moveToElement(driver.findElement(By.xpath("//div[@data-test='HEADER-MENU']//a[@href='/msk/cinema/']"))) | |
| .build() | |
| .perform(); | |
| driver.findElement(By.xpath("//div[@data-test='SUGGEST']//a[.='Скоро онлайн в Okko']")).click(); | |
| Assertions.assertEquals(driver.getCurrentUrl(), "https://www.afisha.ru/movie/okko-soon/"); | |
| } | |
| @AfterEach | |
| void tearDown() { | |
| driver.quit(); | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment