forked from muhomorka/muhomorka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathom.java
72 lines (45 loc) · 2.16 KB
/
om.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import static org.junit.Assert.assertEquals;
/**
* Created by tapetkov on 8/14/15.
*/
public class Om {
private WebDriver selenium;
@Before
public void setUp() {
selenium = new FirefoxDriver();
}
@Test
public void partMuhomorka() {
selenium.get("http://mitove-i-legendi.net/Muhomorka.bg/");
WebElement om = selenium.findElement(By.xpath("/html/body/div[1]/div/div/div/header/div[2]/nav/div/ul/li[1]/a"));
om.click();
assertEquals("http://mitove-i-legendi.net/Muhomorka.bg/", selenium.getCurrentUrl());
WebElement india = selenium.findElement(By.xpath("/html/body/div[3]/div/div/div/div/article/div/p[2]/a[1]"));
india.click();
assertEquals("http://mitove-i-legendi.net/Muhomorka.bg/%D0%B5%D1%82%D0%B8%D0%BA%D0%B5%D1%82/%D0%B8%D0%BD%D0%B4%D0%B8%D1%8F/", selenium.getCurrentUrl());
// The field search in this doesn't work.
//WebElement search = selenium.findElement(By.xpath("/html/body/div[2]/div/div/div[2]/div/aside[1]/form/input[1]"));
//search.clear();
//search.sendKeys("?????");
//WebElement find = selenium.findElement(By.xpath("/html/body/div[2]/div/div/div[2]/div/aside[1]/form/input[1]"))
// find.click();
WebElement backToShop = selenium.findElement(By.className("home"));
backToShop.click();
assertEquals("http://mitove-i-legendi.net/Muhomorka.bg/", selenium.getCurrentUrl());
WebElement nepal = selenium.findElement(By.xpath("/html/body/div[3]/div/div/div/div/article/div/p[2]/a[2]"));
nepal.click();
assertEquals("http://mitove-i-legendi.net/Muhomorka.bg/%D0%B5%D1%82%D0%B8%D0%BA%D0%B5%D1%82/%D0%BD%D0%B5%D0%BF%D0%B0%D0%BB/", selenium.getCurrentUrl());
}
@After
public void close ()
{
selenium.close();
}
}