Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

check if browser is W3C instead of Android #3414

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/helper/WebDriver.js
Expand Up @@ -916,7 +916,7 @@ class WebDriver extends Helper {
* {{ react }}
*/
async click(locator, context = null) {
const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick';
const clickMethod = this.browser.isMobile && !this.browser.isW3C ? 'touchClick' : 'elementClick';
const locateFn = prepareLocateFn.call(this, context);

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

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

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

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

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