@@ -36,13 +36,13 @@ public class ConsentViewPage extends Page {
36
36
37
37
WebDriver driver ;
38
38
39
- public ConsentViewPage (WebDriver driver ) throws InterruptedException {
40
- this .driver = driver ;
41
- PageFactory .initElements (driver , this );
42
- logMessage ("Initializing the " + this .getClass ().getSimpleName ()+ " elements" );
43
- PageFactory .initElements (new AppiumFieldDecorator (driver ), this );
44
- Thread .sleep (1000 );
45
- }
39
+ public ConsentViewPage (WebDriver driver ) throws InterruptedException {
40
+ this .driver = driver ;
41
+ PageFactory .initElements (driver , this );
42
+ logMessage ("Initializing the " + this .getClass ().getSimpleName () + " elements" );
43
+ PageFactory .initElements (new AppiumFieldDecorator (driver ), this );
44
+ Thread .sleep (1000 );
45
+ }
46
46
// protected Report reporter = null;
47
47
48
48
@ WithTimeout (time = 30 , chronoUnit = ChronoUnit .SECONDS )
@@ -108,33 +108,9 @@ public ConsentViewPage(WebDriver driver) throws InterruptedException {
108
108
boolean errorFound = false ;
109
109
110
110
public WebElement eleButton (String buttonText ) throws InterruptedException {
111
- Thread .sleep (3000 );
112
- eleButton = (WebElement ) driver
113
- .findElement (By .xpath ("//XCUIElementTypeButton[@name='" + buttonText + "']" ));
114
- Thread .sleep (3000 );
115
- // eleButton = (WebElement) driver.findElement(By.("+buttonText+"));
116
-
111
+ eleButton = driver .findElement (By .xpath ("//XCUIElementTypeButton[@name='" + buttonText + "']" ));
112
+ waitForElement (eleButton , timeOutInSeconds );
117
113
return eleButton ;
118
-
119
- }
120
-
121
- public void loadTime () {
122
- try {
123
-
124
- long startTime = System .currentTimeMillis ();
125
- new WebDriverWait (driver , 120 ).until (ExpectedConditions .presenceOfElementLocated (
126
- By .xpath ("//android.webkit.WebView[contains(@text,'Notice Message App')]" )));
127
- // new WebDriverWait(driver,
128
- // 60).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//android.widget.Button[contains(@text,'Privacy
129
- // Setting')]")));
130
- long endTime = System .currentTimeMillis ();
131
- long totalTime = endTime - startTime ;
132
- System .out .println ("**** Total Message Load Time: " + totalTime + " milliseconds" );
133
- } catch (Exception ex ) {
134
- System .out .println (ex );
135
- throw ex ;
136
- }
137
-
138
114
}
139
115
140
116
public void scrollAndClick (String text ) throws InterruptedException {
@@ -144,16 +120,9 @@ public void scrollAndClick(String text) throws InterruptedException {
144
120
scrollObject .put ("direction" , "down" );
145
121
js .executeScript ("mobile: scroll" , scrollObject );
146
122
js .executeScript ("mobile: scroll" , scrollObject );
147
- Thread .sleep (2000 );
148
-
149
- //driver.findElement(By.xpath("//XCUIElementTypeButton[@name='" + text + "']")).click();
150
123
try {
151
- // long startTime = System.currentTimeMillis();
152
- // new WebDriverWait(driver, 120).until(ExpectedConditions.presenceOfElementLocated(
153
- // By.xpath("//XCUIElementTypeButton[@name='" + text + "']")));
154
- //
155
124
driver .findElement (By .xpath ("//XCUIElementTypeButton[@name='" + text + "']" )).click ();
156
- }catch (Exception ex ){
125
+ } catch (Exception ex ) {
157
126
throw ex ;
158
127
}
159
128
}
@@ -182,27 +151,17 @@ public void expectedList() {
182
151
}
183
152
184
153
public ArrayList <String > getConsentMessageDetails () throws InterruptedException {
185
- Thread .sleep (8000 );
154
+ WebElement ele = driver .findElement (By .xpath ("//XCUIElementTypeButton[@name='Privacy Settings']" ));
155
+
156
+ waitForElement (ele , timeOutInSeconds );
186
157
for (WebElement msg : ConsentMessage ) {
187
158
consentMsg .add (msg .getText ());
188
159
// consentMsg.add(msg.getAttribute("value"));
189
160
}
190
161
return consentMsg ;
191
162
}
192
163
193
- public void getLocation () {
194
- for (WebElement msg : ConsentMessage ) {
195
- Point point = msg .getLocation ();
196
- TouchAction touchAction = new TouchAction ((PerformsTouchActions ) driver );
197
- System .out .println ("******************" );
198
- System .out .println ((point .x ) + (msg .getSize ().getWidth ()));
199
- System .out .println ((point .y ) + (msg .getSize ().getWidth ()));
200
- System .out .println ("******************" );
201
- }
202
- }
203
-
204
164
public String verifyWrongCampaignError () throws InterruptedException {
205
- Thread .sleep (3000 );
206
165
try {
207
166
return WrongCampaignErrorText .get (WrongCampaignErrorText .size () - 1 ).getText ();
208
167
} catch (Exception e ) {
0 commit comments