Skip to content

Commit e956cb8

Browse files
authored
use W3C standards when interfacing with appium. (#3317)
* use W3C standards when interfacing with appium. It may still be broken when interfacing Ios, because I have no idea what IOS platform name is * platform name is in capabilities
1 parent 81f2280 commit e956cb8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/helper/WebDriver.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ class WebDriver extends Helper {
907907
* {{ react }}
908908
*/
909909
async click(locator, context = null) {
910-
const clickMethod = this.browser.isMobile ? 'touchClick' : 'elementClick';
910+
const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick';
911911
const locateFn = prepareLocateFn.call(this, context);
912912

913913
const res = await findClickable.call(this, locator, locateFn);
@@ -1117,7 +1117,7 @@ class WebDriver extends Helper {
11171117
* Appium: not tested
11181118
*/
11191119
async checkOption(field, context = null) {
1120-
const clickMethod = this.browser.isMobile ? 'touchClick' : 'elementClick';
1120+
const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick';
11211121
const locateFn = prepareLocateFn.call(this, context);
11221122

11231123
const res = await findCheckable.call(this, field, locateFn);
@@ -1136,7 +1136,7 @@ class WebDriver extends Helper {
11361136
* Appium: not tested
11371137
*/
11381138
async uncheckOption(field, context = null) {
1139-
const clickMethod = this.browser.isMobile ? 'touchClick' : 'elementClick';
1139+
const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick';
11401140
const locateFn = prepareLocateFn.call(this, context);
11411141

11421142
const res = await findCheckable.call(this, field, locateFn);
@@ -1623,15 +1623,15 @@ class WebDriver extends Helper {
16231623
assertElementExists(res);
16241624
const elem = usingFirstElement(res);
16251625
const elementId = getElementId(elem);
1626-
if (this.browser.isMobile) return this.browser.touchScroll(offsetX, offsetY, elementId);
1626+
if (this.browser.isMobile && this.browser.capabilities.platformName !== 'android') return this.browser.touchScroll(offsetX, offsetY, elementId);
16271627
const location = await elem.getLocation();
16281628
assertElementExists(location, 'Failed to receive', 'location');
16291629
/* eslint-disable prefer-arrow-callback */
16301630
return this.browser.execute(function (x, y) { return window.scrollTo(x, y); }, location.x + offsetX, location.y + offsetY);
16311631
/* eslint-enable */
16321632
}
16331633

1634-
if (this.browser.isMobile) return this.browser.touchScroll(locator, offsetX, offsetY);
1634+
if (this.browser.isMobile && this.browser.capabilities.platformName !== 'android') return this.browser.touchScroll(locator, offsetX, offsetY);
16351635

16361636
/* eslint-disable prefer-arrow-callback, comma-dangle */
16371637
return this.browser.execute(function (x, y) { return window.scrollTo(x, y); }, offsetX, offsetY);

0 commit comments

Comments
 (0)