@@ -98,25 +98,25 @@ private String getZoomScript() {
9898 }
9999
100100 private long retrievePageHeight () {
101- if (!isAppiumAndroidContext ()) {
101+ if (!isAppiumContext ()) {
102102 if (getZoom ().equals ("100%" )) {
103- return (long ) executeScript ("if (self.outerHeight ) {return self.outerHeight ;} if (document.documentElement && document.documentElement.clientHeight) {return document.documentElement.clientHeight;}if (document.body) {return document.body.clientHeight;}" );
103+ return (long ) executeScript ("if (window.innerHeight ) {return window.innerHeight ;} if (document.documentElement && document.documentElement.clientHeight) {return document.documentElement.clientHeight;}if (document.body) {return document.body.clientHeight;}" );
104104 } else {
105105 return (long ) executeScript ("return document.getElementsByTagName('body')[0].offsetHeight" );
106106 }
107107 } else {
108108 if (isAppiumNativeMobileContext () || isAppiumIOSContext ()) {
109109 return driver .manage ().window ().getSize ().getHeight ();
110110 } else {
111- return (long ) executeScript ("if (self.outerHeight ) {return self.outerHeight ;} if (document.documentElement && document.documentElement.clientHeight) {return document.documentElement.clientHeight;}if (document.body) {return document.body.clientHeight;}" );
111+ return (long ) executeScript ("if (self.innerHeight ) {return self.innerHeight ;} if (document.documentElement && document.documentElement.clientHeight) {return document.documentElement.clientHeight;}if (document.body) {return document.body.clientHeight;}" );
112112 }
113113 }
114114 }
115115
116116 private long retrievePageWidth () {
117- if (!isAppiumAndroidContext ()) {
117+ if (!isAppiumContext ()) {
118118 if (getZoom ().equals ("100%" )) {
119- String script = "if (self.outerWidth ) {return self.outerWidth ;} if (document.documentElement && document.documentElement.clientWidth) {return document.documentElement.clientWidth;}if (document.body) {return document.body.clientWidth;}" ;
119+ String script = "if (window.innerWidth ) {return window.innerWidth ;} if (document.documentElement && document.documentElement.clientWidth) {return document.documentElement.clientWidth;}if (document.body) {return document.body.clientWidth;}" ;
120120 return (long ) executeScript (script );
121121 } else {
122122 return (long ) executeScript ("return document.getElementsByTagName('body')[0].offsetWidth" );
@@ -125,7 +125,7 @@ private long retrievePageWidth() {
125125 if (isAppiumNativeMobileContext () || isAppiumIOSContext ()) {
126126 return driver .manage ().window ().getSize ().getWidth ();
127127 } else {
128- return (long ) executeScript ("if (self.outerWidth ) {return self.outerWidth;} if (document.documentElement && document.documentElement.clientWidth) {return document.documentElement.clientWidth;}if (document.body) {return document.body.clientWidth;}" );
128+ return (long ) executeScript ("if (self.innerWidth ) {return self.outerWidth;} if (document.documentElement && document.documentElement.clientWidth) {return document.documentElement.clientWidth;}if (document.body) {return document.body.clientWidth;}" );
129129 }
130130 }
131131 }
0 commit comments