@@ -103,13 +103,13 @@ private void clickAtom() throws Exception {
103
103
}
104
104
105
105
private void clickNative () throws Exception {
106
- WorkingMode origin = session .getMode ();
107
- session .setMode (WorkingMode .Native );
106
+
108
107
((JavascriptExecutor ) nativeDriver ).executeScript (getNativeElementClickOnIt ());
109
- session .setMode (origin );
110
- long start = System .currentTimeMillis ();
111
108
112
- /*while (true) {
109
+
110
+
111
+ /* long start = System.currentTimeMillis();
112
+ while (true) {
113
113
long end = System.currentTimeMillis();
114
114
System.out.println((end-start)+"ms,is loading? :" + session.getContext().getDOMContext().isLoading());
115
115
} */
@@ -185,7 +185,6 @@ private String getNativeElementClickOnIt() throws Exception {
185
185
// web stuff.
186
186
scrollIntoViewIfNeeded ();
187
187
Point po = findPosition ();
188
- System .out .println ("click native on po :" + po .toString ());
189
188
190
189
Dimension dim = inspector .getSize ();
191
190
int webPageWidth = inspector .getInnerWidth ();
@@ -320,27 +319,24 @@ private UIAElement getNativeElement() throws Exception {
320
319
321
320
UIARect rect = null ;
322
321
UIARect offset = null ;
323
- try {
324
- session .setMode (WorkingMode .Native );
325
- UIAElement sv = nativeDriver .findElement (new TypeCriteria (UIAWebView .class ));
326
-
327
- // scrollview container. Doesn't start in 0,0 // x=0,y=96,h=928w=768
328
- // TODO freynaud : should save the current value, and reset to that at
329
- // the end. Not to false.
330
- nativeDriver .configure (WebDriverLikeCommand .RECT ).set ("checkForStale" , false );
331
- rect = sv .getRect ();
332
-
333
- UIAElement addressBar = nativeDriver
334
- .findElement (
335
- new AndCriteria (new TypeCriteria (UIAElement .class ), new NameCriteria ("Address" ,
336
- L10NStrategy .serverL10N ),
337
- new LabelCriteria ("Address" , L10NStrategy .serverL10N )));
338
- offset = addressBar .getRect ();
339
- nativeDriver .configure (WebDriverLikeCommand .RECT ).set ("checkForStale" , true );
340
- // rect = sv.getRect();
341
- } finally {
342
- session .setMode (origin );
343
- }
322
+
323
+ session .setMode (WorkingMode .Native );
324
+ UIAElement sv = nativeDriver .findElement (new TypeCriteria (UIAWebView .class ));
325
+
326
+ // scrollview container. Doesn't start in 0,0 // x=0,y=96,h=928w=768
327
+ // TODO freynaud : should save the current value, and reset to that at
328
+ // the end. Not to false.
329
+ nativeDriver .configure (WebDriverLikeCommand .RECT ).set ("checkForStale" , false );
330
+ rect = sv .getRect ();
331
+
332
+ UIAElement addressBar = nativeDriver
333
+ .findElement (
334
+ new AndCriteria (new TypeCriteria (UIAElement .class ), new NameCriteria ("Address" ,
335
+ L10NStrategy .serverL10N ),
336
+ new LabelCriteria ("Address" , L10NStrategy .serverL10N )));
337
+ offset = addressBar .getRect ();
338
+ nativeDriver .configure (WebDriverLikeCommand .RECT ).set ("checkForStale" , true );
339
+ // rect = sv.getRect();
344
340
345
341
int top = po .getY ();
346
342
int left = po .getX ();
@@ -361,12 +357,9 @@ private UIAElement getNativeElement() throws Exception {
361
357
delta = 96 ;
362
358
}
363
359
int y = delta + top ;
364
- try {
365
- session .setMode (WorkingMode .Native );
366
- nativeElement = nativeDriver .findElement (new LocationCriteria (x , y ));
367
- } finally {
368
- session .setMode (origin );
369
- }
360
+
361
+ nativeElement = nativeDriver .findElement (new LocationCriteria (x , y ));
362
+
370
363
371
364
}
372
365
return nativeElement ;
@@ -833,11 +826,9 @@ public void setValueNative(String value) throws Exception {
833
826
* session.getNativeDriver().pinchClose(300, 400, 50, 100, 1); } finally {
834
827
* session.setMode(origin); }
835
828
*/
836
- WorkingMode origin = session .getMode ();
837
- session .setMode (WorkingMode .Native );
829
+
838
830
((JavascriptExecutor ) nativeDriver )
839
831
.executeScript (getNativeElementClickOnItAndTypeUsingKeyboardScript (value ));
840
- session .setMode (origin );
841
832
}
842
833
843
834
public void scrollIntoViewIfNeeded () throws Exception {
0 commit comments