Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть ✔ How To Mock A Geolocation Using Chrome DevTools: Selenium 4 | (Video 164)

  • Rex Jones II
  • 2020-12-03
  • 995
✔ How To Mock A Geolocation Using Chrome DevTools: Selenium 4 | (Video 164)
Mock GeolocationEmulate GeolocationHow To Mock Geolocation Selenium 4selenium 4 cdpselenium4selenium 4 alphachromedevtoolsselenium version 4selenium 4 tutorialchrome devtools protocolchrome dev toolschrome devtoolschrome developer toolsdev toolsselenium 4 chrome devtools protocolgetdevtools()selenium 4 chrome debugging protocolChrome DevTools ProtocolChrome Debugging ProtocolGet Location In Selenium 4emulate geolocation coordinates
  • ok logo

Скачать ✔ How To Mock A Geolocation Using Chrome DevTools: Selenium 4 | (Video 164) бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно ✔ How To Mock A Geolocation Using Chrome DevTools: Selenium 4 | (Video 164) или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку ✔ How To Mock A Geolocation Using Chrome DevTools: Selenium 4 | (Video 164) бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео ✔ How To Mock A Geolocation Using Chrome DevTools: Selenium 4 | (Video 164)

How To Mock A Geolocation Using Chrome DevTools: Selenium 4

► Watch Complete Selenium 4 Playlist/Series    • Selenium 4 New Features  

► Download Code, Presentation, and Transcript https://github.com/RexJonesII/Free-Vi...

► Free Selenium PDF Book: https://www.rexjones2.com/book-seleni...
► Free Java PDF Book: https://www.rexjones2.com/book-part-1...
► All Paperback & eBooks: http://tinyurl.com/Rex-Allen-Jones-Books

Social Media Contact
✔ YouTube    / rexjonesii  
✔ Twitter   / rexjonesii  
✔ LinkedIn   / rexjones34  
✔ GitHub https://github.com/RexJonesII/Free-Vi...
✔ Facebook   / jonesrexii  

► Transcript
In this session, I will show you how to mock a Geolocation using Selenium 4 CDP. Mock means imitate and Geolocation refers to the geographical location of a device connected to the internet. The device can be anything a phone, laptop, or even a watch. We use geolocation for events like finding the location of a place. On Selenium’s site, we see Chrome DevTools, Emulate Geo Location, description and code to Emulate the Geo Location.

The description says “Some applications have different features and functionalities across different locations. But with the help of DevTools, we can easily emulate them.” Depending on the application, we can see different information because the application is in a different location. With this help of the Chrome DevTools Protocol, the application can have the same information after mocking the geolocation. We can mock, well this site says emulate. We can emulate the geolocation by making our browser be in the same location.

As a result, the application will have the same features and functionalities we are trying to test. For example, I live in Texas but on my project, I work with people who live in India. If our application showed different information in India then I would change my location to be in India. For this test, I’m going to make my browser be located in the capital of India. In this pom.xml file, I changed my Selenium 4 version to alpha 7.

From scratch, I’m going to write @Test / public void mockGeoLocation () { } set up our browser by writing WebDriverManager.chromedriver().setup();ChromeDriver is the type and driver = is the object new ChromeDriver ();. Maximize the window: driver.manage().window().maximize(); / driver.exec .Notice, how executeCdpCommand has String commandName and Map for the parameters.

In the sample code, the command is Emulation.setGeolocationOverride and coordinates for the Map. The coordinates are latitude, longitude, and accuracy. For more information, we can go to github. The url is https://chromedevtools.github.io/devt..., search for Geo and we see Emulation.setGeolocationOverride with a description that says Overrides the Geolocation Position or Error. We see all 3 parameters: latitude, longitude, and accuracy.

I’m going to set my geolocation to be at New Delhi. We see the coordinates are 28.6139 for latitude and 77.2090 for longitude. Latitude is always first. We see N for Latitude because the direction is North or South. E for Longitude because the direction is East or West. Our application under test is Where Am I Right Now. I guess this site is accurate. The location is half a mile from my house. We see TX for Texas.

Now, let’s go ahead and complete our script. 1st parameter is String commandName. We saw Emulation.setGeolocationOverride. The 2nd parameter was a Map and copy this code from Selenium’s site and paste it to our code. Change latitude to 28.6139 and longitude is 77.2090, leave accuracy at 1. Now, I can pass in coordinates. Last step, is to load the Application Under Test: driver.get(“https://where-am-i.org/”);

Now, let’s Run. We see New Delhi for Location. We see Latitude and Longitude. Also, here’s the map. Thanks for watching and I’ll see you in the next session for enabling the network.

#MockGeoLocation #EmulateGeoLocation #Selenium4

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]