CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

I.grab/setGeoLocation is not working with WebDriver

Open seganfredo63 opened this issue 5 years ago • 2 comments

What are you trying to achieve?

I'm trying to grab/set the geolocation in order to test different scenarios for different countries.

Before(async () => {
    I.amOnPage("/");
    let geo = await I.grabGeoLocation()
    console.log(geo)
})

Also tried grabbing the geo location before accessing the page:

Before(async () => {
    let geo = await I.grabGeoLocation()
    I.amOnPage("/");
    console.log(geo)
})

I tried to use I.setGeoLocation too, the result is the same.

In case grab/setGeoLocation methods are not available anymore, please remove them from the documentation

What do you get instead?

       "before each" hook: Before for "My test @myTag":
     this.browser.getGeoLocation is not a function

Provide test source code if related

Before(async () => {
    I.amOnPage("/");
    let geo = await I.grabGeoLocation()
    console.log(geo)
})

Details

  • CodeceptJS version: 2.6.3
  • NodeJS Version: 12.10.0
  • Operating System: Windows 10
  • puppeteer || webdriverio || protractor || testcafe version (if related) - WebDriver + Selenoid
  • Configuration file:
require('dotenv').config()
const { setHeadlessWhen } = require('@codeceptjs/configure');

setHeadlessWhen(process.env.HEADLESS);

exports.config = {
  tests: './tests/**/**/*_test.js',
  output: './output',
  helpers: {
    WebDriver: {
      url: process.env.BASE_URL,
      browser: process.env.BROWSER || 'chrome',
      restart: false,
      host: '127.0.0.1',
      port: 4444,
      protocol: 'http',
      windowSize: '1600x1080',
      outputDir: './output',
    },
    ChaiWrapper: {
      require: "codeceptjs-chai"
    },
    CustomHelper: {
      require: './helpers/utils/customHelper.js'
    }
  },
  include: {
    myPage: "path/to/page"
  },
  bootstrap: null,
  mocha: {},
  name: 'automation',
  plugins: {
    selenoid: {
      enabled: true,
      deletePassed: false,
      autoCreate: false,
      autoStart: false,
      sessionTimeout: '20m',
      enableVideo: false,
      enableLog: true,
      // enableVNC: true
    },
    retryFailedStep: {
      enabled: true
    },
    screenshotOnFail: {
      enabled: true
    },
  },
}

seganfredo63 avatar Jul 28 '20 14:07 seganfredo63

Also facing the same issue. The setGeoLocation function is not available in this.browser.

this.browser.setGeoLocation is not a function at WebDriver.setGeoLocation (node_modules/codeceptjs/lib/helper/WebDriver.js:2482:25)

pratikghedia avatar Mar 10 '21 20:03 pratikghedia

Is this being worked on? I'm having the same issues with these geoLocation functions.

pignarg avatar Jun 28 '22 12:06 pignarg

Hello , I'm also facing the same issues with geoLocation functions.

await I.setGeolocation(latitude, longitude) this.browser.setGeoLocation is not a function WebDriver.setGeoLocation (node_modules\codeceptjs\lib\helper\WebDriver.js:2455:25)

using latest codeceptjs version =3.5.10

autotest-web avatar Dec 29 '23 10:12 autotest-web

@peterngtr Can you please look into the issue mentioned above asap, Added geolocation actions in 2.3.0v https://codecept.io/changelog/#_2-3-0

autotest-web avatar Jan 02 '24 13:01 autotest-web

resolved by #4105

kobenguyent avatar Feb 05 '24 09:02 kobenguyent