Skip to content

Commit 2dd7246

Browse files
authored
check if browser is W3C instead of Android (#3414)
1 parent 4319235 commit 2dd7246

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
@@ -916,7 +916,7 @@ class WebDriver extends Helper {
916916
* {{ react }}
917917
*/
918918
async click(locator, context = null) {
919-
const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick';
919+
const clickMethod = this.browser.isMobile && !this.browser.isW3C ? 'touchClick' : 'elementClick';
920920
const locateFn = prepareLocateFn.call(this, context);
921921

922922
const res = await findClickable.call(this, locator, locateFn);
@@ -1126,7 +1126,7 @@ class WebDriver extends Helper {
11261126
* Appium: not tested
11271127
*/
11281128
async checkOption(field, context = null) {
1129-
const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick';
1129+
const clickMethod = this.browser.isMobile && !this.browser.isW3C ? 'touchClick' : 'elementClick';
11301130
const locateFn = prepareLocateFn.call(this, context);
11311131

11321132
const res = await findCheckable.call(this, field, locateFn);
@@ -1145,7 +1145,7 @@ class WebDriver extends Helper {
11451145
* Appium: not tested
11461146
*/
11471147
async uncheckOption(field, context = null) {
1148-
const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick';
1148+
const clickMethod = this.browser.isMobile && !this.browser.isW3C ? 'touchClick' : 'elementClick';
11491149
const locateFn = prepareLocateFn.call(this, context);
11501150

11511151
const res = await findCheckable.call(this, field, locateFn);
@@ -1632,15 +1632,15 @@ class WebDriver extends Helper {
16321632
assertElementExists(res);
16331633
const elem = usingFirstElement(res);
16341634
const elementId = getElementId(elem);
1635-
if (this.browser.isMobile && this.browser.capabilities.platformName !== 'android') return this.browser.touchScroll(offsetX, offsetY, elementId);
1635+
if (this.browser.isMobile && !this.browser.isW3C) return this.browser.touchScroll(offsetX, offsetY, elementId);
16361636
const location = await elem.getLocation();
16371637
assertElementExists(location, 'Failed to receive', 'location');
16381638
/* eslint-disable prefer-arrow-callback */
16391639
return this.browser.execute(function (x, y) { return window.scrollTo(x, y); }, location.x + offsetX, location.y + offsetY);
16401640
/* eslint-enable */
16411641
}
16421642

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

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

0 commit comments

Comments
 (0)