-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSelenium-ACS
99 lines (88 loc) · 3.99 KB
/
Selenium-ACS
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package Simo;
import org.openqa.selenium.*;
import org.openqa.selenium.htmlunit.*;
import org.openqa.selenium.firefox.*;
import org.openqa.selenium.chrome.*;
import org.openqa.selenium.ie.*;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.*;
import static org.testng.Assert.*;
public class SimoGUITest {
WebDriver driver;
@BeforeMethod
public void startSelenium() {
driver = new FirefoxDriver();
}
@AfterMethod
public void stopSelenium() {
driver.close();
}
@Test
public void testSimoGUI() throws InterruptedException {
driver.get("http://localhost:8270/gui/");
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
driver.findElement(By.id("openAddDeviceDialog")).click();
driver.findElement(By.id("newDeviceInput")).sendKeys("COM2");
WebElement mySelectElm = driver.findElement(By.id("selectNewDeviceCategory-button"));
mySelectElm.click();
Thread.sleep(1000);
Actions action = new Actions(driver);
action.sendKeys(Keys.ARROW_DOWN).perform();
action.sendKeys(Keys.ENTER).perform();
Thread.sleep(1000);
if (true)
{
WebElement mySelectElm2 = driver.findElement(By.id("selectNewDeviceType-button"));
mySelectElm2.click();
Thread.sleep(1000);
Actions action2 = new Actions(driver);
action2.sendKeys(Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN).perform();Thread.sleep(1000);
action2.sendKeys(Keys.ENTER).perform();
}
driver.findElement(By.id("addNewDeviceButton")).click();
/*
Select select2 = new Select(driver.findElement(By.xpath("/html/body/div[2]/main/div[1]/form/span[2]/span[2]")));
//By.xpath("//*[@id='selectNewDeviceType-button']/span[2]")));
select2.selectByVisibleText(" U-PP1");
selenium.click("//div[@id='ACM-deviceInfoContents-COM2']/table[2]/thead/tr");
selenium.click("//div[@id='ACM-deviceInfoContents-COM2']/table[3]/thead/tr");
selenium.click("//div[@id='ACM-deviceInfoContents-COM2']/table[4]/thead/tr");
selenium.click("//div[@id='ACM-deviceInfoContents-COM2']/table[5]/thead/tr");
selenium.click("//div[@id='ACM-deviceInfoContents-COM2']/table[6]/thead/tr");
selenium.click("css=span.bootstrap-switch-handle-off.bootstrap-switch-danger");
selenium.type("id=ACM-COM2-parameterValue-P1-input", "10");
selenium.type("id=ACM-COM2-parameterValue-P1_Cable_Fault", "1");
selenium.click("id=ACM-device-COM2-parameterButton");
selenium.click("css=span.bootstrap-switch-handle-on.bootstrap-switch-success");
selenium.click("css=span.bootstrap-switch-handle-off.bootstrap-switch-danger");
selenium.click("id=ACM-device-COM2-removeDeviceButton");
selenium.click("//div[3]/div[3]/div");
selenium.click("xpath=(//button[@type='button'])[4]");
selenium.click("id=openAddDeviceDialog");
selenium.type("id=newDeviceInput", "COM3");
selenium.click("css=span.ui-selectmenu-text");
selenium.click("id=ui-id-23");
selenium.click("css=#selectNewDeviceType-button > span.ui-selectmenu-text");
selenium.click("id=ui-id-31");
selenium.click("id=addNewDeviceButton");
selenium.click("//div[@id='ACM-deviceInfoContents-COM3']/table[2]/thead/tr");
selenium.click("//div[@id='ACM-deviceInfoContents-COM3']/table[3]/thead/tr");
selenium.click("//div[@id='ACM-deviceInfoContents-COM3']/table[4]/thead/tr");
selenium.click("//div[@id='ACM-deviceInfoContents-COM3']/table[5]/thead/tr");
selenium.click("//div[@id='ACM-deviceInfoContents-COM3']/table[6]/thead/tr");
selenium.click("css=span.bootstrap-switch-handle-off.bootstrap-switch-danger");
selenium.type("id=ACM-COM3-parameterValue-P3-input", "20");
selenium.click("id=ACM-device-COM3-parameterButton");
selenium.click("id=ACM-device-COM3-removeDeviceButton");
selenium.click("xpath=(//button[@type='button'])[5]");
selenium.click("id=ACM-device-COM3-removeDeviceButton");
selenium.click("xpath=(//button[@type='button'])[4]");
*/
}
}