Skip to content

Commit bba4ef6

Browse files
committed
Duplicate from STARHOTEL-Teaching-Materials
1 parent bd49a86 commit bba4ef6

File tree

217 files changed

+59036
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

217 files changed

+59036
-3
lines changed

.classpath

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="test"/>
4+
<classpathentry kind="lib" path="lib/selenium-java-2.35.0.jar"/>
5+
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
6+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
7+
<classpathentry kind="lib" path="lib/apache-mime4j-0.6.jar"/>
8+
<classpathentry kind="lib" path="lib/bsh-1.3.0.jar"/>
9+
<classpathentry kind="lib" path="lib/cglib-nodep-2.1_3.jar"/>
10+
<classpathentry kind="lib" path="lib/commons-codec-1.6.jar"/>
11+
<classpathentry kind="lib" path="lib/commons-collections-3.2.1.jar"/>
12+
<classpathentry kind="lib" path="lib/commons-exec-1.1.jar"/>
13+
<classpathentry kind="lib" path="lib/commons-io-2.2.jar"/>
14+
<classpathentry kind="lib" path="lib/commons-jxpath-1.3.jar"/>
15+
<classpathentry kind="lib" path="lib/commons-lang3-3.1.jar"/>
16+
<classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
17+
<classpathentry kind="lib" path="lib/cssparser-0.9.9.jar"/>
18+
<classpathentry kind="lib" path="lib/guava-14.0.jar"/>
19+
<classpathentry kind="lib" path="lib/hamcrest-core-1.3.jar"/>
20+
<classpathentry kind="lib" path="lib/hamcrest-library-1.3.jar"/>
21+
<classpathentry kind="lib" path="lib/htmlunit-2.12.jar"/>
22+
<classpathentry kind="lib" path="lib/htmlunit-core-js-2.12.jar"/>
23+
<classpathentry kind="lib" path="lib/httpclient-4.2.1.jar"/>
24+
<classpathentry kind="lib" path="lib/httpcore-4.2.1.jar"/>
25+
<classpathentry kind="lib" path="lib/httpmime-4.2.1.jar"/>
26+
<classpathentry kind="lib" path="lib/ini4j-0.5.2.jar"/>
27+
<classpathentry kind="lib" path="lib/jcommander-1.29.jar"/>
28+
<classpathentry kind="lib" path="lib/jetty-websocket-8.1.8.jar"/>
29+
<classpathentry kind="lib" path="lib/jna-3.4.0.jar"/>
30+
<classpathentry kind="lib" path="lib/jna-platform-3.4.0.jar"/>
31+
<classpathentry kind="lib" path="lib/json-20080701.jar"/>
32+
<classpathentry kind="lib" path="lib/junit-dep-4.11.jar"/>
33+
<classpathentry kind="lib" path="lib/nekohtml-1.9.17.jar"/>
34+
<classpathentry kind="lib" path="lib/netty-3.5.7.Final.jar"/>
35+
<classpathentry kind="lib" path="lib/operadriver-1.4.jar"/>
36+
<classpathentry kind="lib" path="lib/phantomjsdriver-1.0.4.jar"/>
37+
<classpathentry kind="lib" path="lib/protobuf-java-2.4.1.jar"/>
38+
<classpathentry kind="lib" path="lib/sac-1.3.jar"/>
39+
<classpathentry kind="lib" path="lib/serializer-2.7.1.jar"/>
40+
<classpathentry kind="lib" path="lib/testng-6.8.5.jar"/>
41+
<classpathentry kind="lib" path="lib/xalan-2.7.1.jar"/>
42+
<classpathentry kind="lib" path="lib/xercesImpl-2.10.0.jar"/>
43+
<classpathentry kind="lib" path="lib/xml-apis-1.4.01.jar"/>
44+
<classpathentry kind="output" path="bin"/>
45+
</classpath>

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin

.project

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>STARHOTEL-Teaching-Materials</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding/<project>=UTF-8

LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2013 Nozomi Ito, Shinsuke Matsuki,
4+
STAR.jp https://sites.google.com/site/testautomationresearch/
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.

README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
STARHOTEL-Teaching-Materials-Simple
2-
===================================
1+
STARHOTEL
2+
=========
33

4-
Simple version of STARHOTEL-Teaching-Materials
4+
The simple version of STARHOTEL-Teaching-Materials(https://github.com/SoftwareTestAutomationResearch/STARHOTEL-Teaching-Materials)
5+
6+
screen shot
7+
===========
8+
!["preview"](https://github.com/snsk/STARHOTEL/blob/master/ss.png?raw=true)

answer/introwork/IntroWork2.java

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
package introwork;
3+
import java.io.File;
4+
5+
import org.apache.commons.lang3.SystemUtils;
6+
import org.junit.After;
7+
import org.junit.Before;
8+
import org.junit.Test;
9+
import org.openqa.selenium.By;
10+
import org.openqa.selenium.WebDriver;
11+
import org.openqa.selenium.WebElement;
12+
import org.openqa.selenium.chrome.ChromeDriver;
13+
14+
/**
15+
* 入門課題その2:「クリックしてみよう」
16+
* 解答例
17+
*/
18+
public class IntroWork2 {
19+
private WebDriver driver;
20+
21+
private String chromeDriverPath() {
22+
String path;
23+
if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) {
24+
path = "chromedriver/mac/chromedriver"; // Mac環境の場合
25+
} else {
26+
path = "chromedriver/win/chromedriver.exe"; // Windows環境の場合
27+
}
28+
File file = new File(path);
29+
return file.getAbsolutePath();
30+
}
31+
32+
@Before
33+
public void setUp() {
34+
System.setProperty("webdriver.chrome.driver", chromeDriverPath());
35+
driver = new ChromeDriver();
36+
}
37+
38+
@After
39+
public void tearDown() {
40+
driver.quit();
41+
}
42+
43+
@Test
44+
public void test() {
45+
File html = new File("introwork/introWork2.html");
46+
String url = "file:///" + html.getAbsolutePath();
47+
driver.get(url);
48+
49+
WebElement okButton = driver.findElement(By.id("ok_button"));
50+
okButton.click();
51+
}
52+
}

answer/introwork/IntroWork3.java

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package introwork;
2+
import java.io.File;
3+
4+
import org.apache.commons.lang3.SystemUtils;
5+
import org.junit.After;
6+
import org.junit.Before;
7+
import org.junit.Test;
8+
import org.openqa.selenium.By;
9+
import org.openqa.selenium.WebDriver;
10+
import org.openqa.selenium.WebElement;
11+
import org.openqa.selenium.chrome.ChromeDriver;
12+
13+
/**
14+
* 入門課題その3:「文字列を入力してみよう」
15+
* 解答例
16+
*/
17+
public class IntroWork3 {
18+
private WebDriver driver;
19+
20+
private String chromeDriverPath() {
21+
String path;
22+
if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) {
23+
path = "chromedriver/mac/chromedriver"; // Mac環境の場合
24+
} else {
25+
path = "chromedriver/win/chromedriver.exe"; // Windows環境の場合
26+
}
27+
File file = new File(path);
28+
return file.getAbsolutePath();
29+
}
30+
31+
@Before
32+
public void setUp() {
33+
System.setProperty("webdriver.chrome.driver", chromeDriverPath());
34+
driver = new ChromeDriver();
35+
}
36+
37+
@After
38+
public void tearDown() {
39+
driver.quit();
40+
}
41+
42+
@Test
43+
public void test() {
44+
File html = new File("introwork/introWork3.html");
45+
String url = "file:///" + html.getAbsolutePath();
46+
driver.get(url);
47+
48+
WebElement subject = driver.findElement(By.id("subject"));
49+
subject.clear();
50+
subject.sendKeys("Selenium");
51+
}
52+
}

answer/introwork/IntroWork4.java

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package introwork;
2+
import java.io.File;
3+
4+
import org.apache.commons.lang3.SystemUtils;
5+
import org.junit.After;
6+
import org.junit.Before;
7+
import org.junit.Test;
8+
import org.openqa.selenium.By;
9+
import org.openqa.selenium.WebDriver;
10+
import org.openqa.selenium.WebElement;
11+
import org.openqa.selenium.chrome.ChromeDriver;
12+
13+
/**
14+
* 入門課題その4:「ラジオボタンを選択してみよう」
15+
* 解答例
16+
*/
17+
public class IntroWork4 {
18+
private WebDriver driver;
19+
20+
private String chromeDriverPath() {
21+
String path;
22+
if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) {
23+
path = "chromedriver/mac/chromedriver"; // Mac環境の場合
24+
} else {
25+
path = "chromedriver/win/chromedriver.exe"; // Windows環境の場合
26+
}
27+
File file = new File(path);
28+
return file.getAbsolutePath();
29+
}
30+
31+
@Before
32+
public void setUp() {
33+
System.setProperty("webdriver.chrome.driver", chromeDriverPath());
34+
driver = new ChromeDriver();
35+
}
36+
37+
@After
38+
public void tearDown() {
39+
driver.quit();
40+
}
41+
42+
@Test
43+
public void test() {
44+
File html = new File("introwork/introWork4.html");
45+
String url = "file:///" + html.getAbsolutePath();
46+
driver.get(url);
47+
48+
WebElement onRadio = driver.findElement(By.id("on_radio"));
49+
onRadio.click();
50+
}
51+
}

answer/introwork/IntroWork5.java

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package introwork;
2+
import java.io.File;
3+
4+
import org.apache.commons.lang3.SystemUtils;
5+
import org.junit.After;
6+
import org.junit.Before;
7+
import org.junit.Test;
8+
import org.openqa.selenium.By;
9+
import org.openqa.selenium.WebDriver;
10+
import org.openqa.selenium.WebElement;
11+
import org.openqa.selenium.chrome.ChromeDriver;
12+
13+
/**
14+
* 入門課題その5:「チェックボックスを選択してみよう」
15+
* 解答例
16+
*/
17+
public class IntroWork5 {
18+
private WebDriver driver;
19+
20+
private String chromeDriverPath() {
21+
String path;
22+
if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) {
23+
path = "chromedriver/mac/chromedriver"; // Mac環境の場合
24+
} else {
25+
path = "chromedriver/win/chromedriver.exe"; // Windows環境の場合
26+
}
27+
File file = new File(path);
28+
return file.getAbsolutePath();
29+
}
30+
31+
@Before
32+
public void setUp() {
33+
System.setProperty("webdriver.chrome.driver", chromeDriverPath());
34+
driver = new ChromeDriver();
35+
}
36+
37+
@After
38+
public void tearDown() {
39+
driver.quit();
40+
}
41+
42+
@Test
43+
public void test() {
44+
File html = new File("introwork/introWork5.html");
45+
String url = "file:///" + html.getAbsolutePath();
46+
driver.get(url);
47+
48+
WebElement allowedCheck = driver.findElement(By.id("allowed_check"));
49+
if (!allowedCheck.isSelected()) {
50+
allowedCheck.click();
51+
}
52+
}
53+
}

answer/introwork/IntroWork6.java

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package introwork;
2+
import java.io.File;
3+
4+
import org.apache.commons.lang3.SystemUtils;
5+
import org.junit.After;
6+
import org.junit.Before;
7+
import org.junit.Test;
8+
import org.openqa.selenium.By;
9+
import org.openqa.selenium.WebDriver;
10+
import org.openqa.selenium.WebElement;
11+
import org.openqa.selenium.chrome.ChromeDriver;
12+
import org.openqa.selenium.support.ui.Select;
13+
14+
/**
15+
* 入門課題その6:「プルダウンを選択してみよう」
16+
*/
17+
public class IntroWork6 {
18+
private WebDriver driver;
19+
20+
private String chromeDriverPath() {
21+
String path;
22+
if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) {
23+
path = "chromedriver/mac/chromedriver"; // Mac環境の場合
24+
} else {
25+
path = "chromedriver/win/chromedriver.exe"; // Windows環境の場合
26+
}
27+
File file = new File(path);
28+
return file.getAbsolutePath();
29+
}
30+
31+
@Before
32+
public void setUp() {
33+
System.setProperty("webdriver.chrome.driver", chromeDriverPath());
34+
driver = new ChromeDriver();
35+
}
36+
37+
@After
38+
public void tearDown() {
39+
driver.quit();
40+
}
41+
42+
@Test
43+
public void test() {
44+
File html = new File("introwork/introWork6.html");
45+
String url = "file:///" + html.getAbsolutePath();
46+
driver.get(url);
47+
48+
WebElement headCount = driver.findElement(By.id("head_count"));
49+
Select select = new Select(headCount);
50+
select.selectByValue("5");
51+
}
52+
}

0 commit comments

Comments
 (0)