nightwatchjs / nightwatch

Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack
https://nightwatchjs.org
MIT License
11.78k stars 1.31k forks source link

Css zoom causes nightwatch to click on the wrong element. #2724

Closed gelform closed 2 years ago

gelform commented 3 years ago

Describe the bug

A page with the css rule zoom: 1.2; causes nightwatch to click on the wrong element.

Configuration

nightwatch.json

```js // Autogenerated by Nightwatch // Refer to the online docs for more details: https://nightwatchjs.org/gettingstarted/configuration/ const Services = {}; loadServices(); module.exports = { // An array of folders (excluding subfolders) where your tests are located; // if this is not specified, the test source must be passed as the second argument to the test runner. src_folders: ["_tests"], // See https://nightwatchjs.org/guide/working-with-page-objects/ page_objects_path: "", // See https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-commands custom_commands_path: "_tests/_commands", // See https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-assertions custom_assertions_path: "", // See https://nightwatchjs.org/guide/#external-globals globals_path: "", webdriver: { start_process: true, server_path: "/usr/local/bin/chromedriver", port: 9515, }, test_settings: { default: { disable_error_log: false, launch_url: "https://nightwatchjs.org", screenshots: { enabled: false, path: "screens", on_failure: true, }, desiredCapabilities: { browserName: "chrome", "goog:chromeOptions": { w3c: false, excludeSwitches: ["enable-automation"], args: [ "disable-gpu", "disable-dev-shm-usage", "window-size=1500,1300", ], }, }, webdriver: { start_process: true, server_path: Services.chromedriver ? Services.chromedriver.path : "", }, }, safari: { desiredCapabilities: { browserName: "safari", alwaysMatch: { acceptInsecureCerts: false, }, }, webdriver: { port: 4445, start_process: true, server_path: "/usr/bin/safaridriver", }, }, firefox: { desiredCapabilities: { browserName: "firefox", alwaysMatch: { // Enable this if you encounter unexpected SSL certificate errors in Firefox // acceptInsecureCerts: true, "moz:firefoxOptions": { args: [ // '-headless', // '-verbose' ], }, }, }, webdriver: { start_process: true, port: 4444, server_path: Services.geckodriver ? Services.geckodriver.path : "", cli_args: [ // very verbose geckodriver logs // '-vv' ], }, }, chrome: { desiredCapabilities: { browserName: "chrome", chromeOptions: { // This tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78) // w3c: false, // More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/ args: [ //'--no-sandbox', //'--ignore-certificate-errors', //'--allow-insecure-localhost', //'--headless' ], }, }, webdriver: { start_process: true, port: 9515, server_path: Services.chromedriver ? Services.chromedriver.path : "", cli_args: [ // --verbose ], }, }, ////////////////////////////////////////////////////////////////////////////////// // Configuration for when using the browserstack.com cloud service | // | // Please set the username and access key by setting the environment variables: | // - BROWSERSTACK_USER | // - BROWSERSTACK_KEY | // .env files are supported | ////////////////////////////////////////////////////////////////////////////////// browserstack: { selenium: { host: "hub-cloud.browserstack.com", port: 443, }, // More info on configuring capabilities can be found on: // https://www.browserstack.com/automate/capabilities?tag=selenium-4 desiredCapabilities: { "bstack:options": { local: "false", userName: "${BROWSERSTACK_USER}", accessKey: "${BROWSERSTACK_KEY}", }, }, disable_error_log: true, webdriver: { keep_alive: true, start_process: false, }, }, "browserstack.chrome": { extends: "browserstack", desiredCapabilities: { browserName: "chrome", chromeOptions: { // This tells Chromedriver to run using the legacy JSONWire protocol // More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/ w3c: false, }, }, }, "browserstack.firefox": { extends: "browserstack", desiredCapabilities: { browserName: "firefox", }, }, "browserstack.ie": { extends: "browserstack", desiredCapabilities: { browserName: "IE", browserVersion: "11.0", "bstack:options": { os: "Windows", osVersion: "10", local: "false", seleniumVersion: "3.5.2", resolution: "1366x768", }, }, }, ////////////////////////////////////////////////////////////////////////////////// // Configuration for when using the Selenium service, either locally or remote, | // like Selenium Grid | ////////////////////////////////////////////////////////////////////////////////// selenium: { // Selenium Server is running locally and is managed by Nightwatch selenium: { start_process: true, port: 4444, server_path: Services.seleniumServer ? Services.seleniumServer.path : "", cli_args: { "webdriver.gecko.driver": Services.geckodriver ? Services.geckodriver.path : "", "webdriver.chrome.driver": Services.chromedriver ? Services.chromedriver.path : "", }, }, }, "selenium.chrome": { extends: "selenium", desiredCapabilities: { browserName: "chrome", chromeOptions: { w3c: false, }, }, }, "selenium.firefox": { extends: "selenium", desiredCapabilities: { browserName: "firefox", "moz:firefoxOptions": { args: [ // '-headless', // '-verbose' ], }, }, }, }, }; function loadServices() { try { Services.seleniumServer = require("selenium-server"); } catch (err) {} try { Services.chromedriver = require("chromedriver"); } catch (err) {} try { Services.geckodriver = require("geckodriver"); } catch (err) {} } ```

Your Environment

Executable Version
nightwatch --version 1.6.4
npm --version 6.14.12
node --version 14.16.1
Browser driver Version
Chrome 90.0.1
OS Version
MacOS 11.3.1
beatfactor commented 3 years ago

Not sure how we can fix this in nightwatch. Also, you didn't include a sample test which makes it even more difficult to debug the issue.

gelform commented 3 years ago

I wasn't sure how to add a test for this. add zoom: 1.2; to a page and have nightwatch click on any element.

But if it's outside the functionality of nightwatch, feel free to close this issue. Doesn't seem bad to have it documented, at least, as I spent a lot of time searching for a bug report and/or fix.

On Fri, Jun 4, 2021 at 11:36 AM Andrei Rusu @.***> wrote:

Not sure how we can fix this in nightwatch. Also, you didn't include a sample test which makes it even more difficult to debug the issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nightwatchjs/nightwatch/issues/2724#issuecomment-854820075, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASNRXM2FTBDGXBXRYS6FU3TRDXGXANCNFSM456EMULA .

--

Corey Maass 646-228-5048 Eastern Timezone (UTC-5:00)

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had any recent activity. If possible, please retry using the latest Nightwatch version and update the issue with any relevant details. If no further activity occurs, it will be closed. Thank you for your contribution.