RegisterPage.java
4.39 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
package com.buyer.pageObject;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import com.essa.framework.BasePage;
import com.essa.framework.Model;
import com.essa.framework.Tools;
/**
* 采购商注册页
* @author Administrator
*
*/
public class RegisterPage extends BasePage {
public RegisterPage(WebDriver driver) {
super(driver);
}
/*
* 元素定位
*/
//检查点-是否进入页面
@FindBy (xpath ="//*[contains(text(),' Own essa.cn account')]")
WebElement checkPoint;
//email
@FindBy (xpath ="//*[@id='email']")
WebElement email;
//password
@FindBy (xpath ="//*[@id='password']")
WebElement password;
//confirmPassword
@FindBy (xpath ="//*[@id='confirmPassword']")
WebElement confirmPassword;
//币种 currency
@FindBy (xpath ="//*[@id='currPlaceholder']")
WebElement currPlaceholder;
//CNY
@FindBy (xpath="//*[text()='CNY']")
WebElement CNY;
//companyName
@FindBy (xpath="//*[@id='companyName']")
WebElement companyName;
//空白的地方-用于关闭选项框
@FindBy (xpath ="//*[@class='register-right']")
WebElement blank;
//区域continent
@FindBy (xpath ="//*[@id='continentPlaceholder']")
WebElement continentPlaceholder;
//欧洲europe
@FindBy (xpath="//div[contains(text(),'Eastern Europe')]")
WebElement Europe;
//country
@FindBy (xpath ="//div[@id='countryPlaceholder']")
WebElement country;
//俄罗斯Russian
@FindBy (xpath ="//div[contains(text(),'Russian federation')]")
WebElement Russian;
//contactName
@FindBy (xpath ="//*[@id='contactName']")
WebElement contactName;
//phone
@FindBy (xpath ="//*[@id='phone']")
WebElement phone;
//purchaseQuantity
@FindBy (xpath ="//*[@id='purchaseQuantity']")
WebElement purchaseQuantity;
//quantity
@FindBy (xpath ="//*[contains(text(),'1 000 000 - 2 500 000 USD')]")
WebElement quantity;
//singleQuantity
@FindBy (xpath ="//*[@id='singleQuantity']")
WebElement singleQuantity;
//single
@FindBy (xpath ="//*[text()='30-49 ctn']")
WebElement single;
//select
@FindBy (xpath ="//*[text()='Select']")
WebElement select;
//toys1
@FindBy (xpath ="//*[@title='Animals&plants']")
WebElement toys1;
//toys2
@FindBy (xpath ="//*[text()='Dolls and accessories']")
WebElement toys2;
//toys3
@FindBy (xpath ="//*[text()='Bricks']")
WebElement toys3;
//referralCode
@FindBy (xpath ="//*[@id='referralCode']")
WebElement referralCode;
//checkBox
@FindBy (xpath ="//*[@id='protocol']")
WebElement checkbox;
//Register
@FindBy (xpath ="//*[@id='submit']")
WebElement register;
//Main Way to Deliver
@FindBy(xpath = "//div[@id='currDeliveryType']")
WebElement currDeliveryType;
//deliveryMode
@FindBy(xpath = "//li[contains(text(),'Whole container')]")
WebElement containerMode;
//businessLicenceNO
@FindBy(xpath = "//input[@id='businessLicenceNO']")
WebElement businessLicenceNO;
//taxRegistrationNO
@FindBy(xpath = "//input[@id='taxRegistrationNO']")
WebElement taxRegistrationNO;
//choosePurchaseType
@FindBy(xpath = "//div[contains(@class,'btn btn-info btn-xz')]")
WebElement choosePurchaseType;
//allToys
@FindBy(xpath = "//em[contains(text(),'All Products')]")
WebElement allToys;
/*
* 页面方法
*/
/**
* 注册
* @return IndexPage
*/
public IndexPage register() {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmm");
String num = Tools.getTime();
sendKeys(email, Model.getEmail());
sendKeys(password, "essa123");
sendKeys(confirmPassword, "essa123");
click(currPlaceholder);
click(CNY);
sendKeys(companyName, "Auto"+num);
click(continentPlaceholder);
sendKeys(contactName, "Tester"+num);
click(currDeliveryType);
click(containerMode);
forceWait(500);
click(Europe);
click(Russian);
// sendKeys(phone, format.format(new Date()));
// click(purchaseQuantity);
// click(quantity);
// forceWait(500);
// click(singleQuantity);
// click(single);
moveHeightScroll("100");
// jsExecutorClick(select);
// click(toys1);
// click(toys2);
// click(toys3);
click(choosePurchaseType);
jsExecutorClick(select);
click(allToys);
click(blank);
sendKeys(businessLicenceNO,"12345678");
sendKeys(taxRegistrationNO,"987654321");
sendKeys(referralCode, Model.getInvateCode());
jsExecutorClick(checkbox);
click(register);
forceWait(3000);
return new IndexPage(driver);
}
}