How can I allow location access using Selenium?

Steve

I am trying to use Selenium in Java to get the user's geographical coordinates, but using IP address isn't accurate enough, so i wanted to use this website http://www.whataremycoordinates.com/ , but it isn't working, and I am guessing it is because you have to allow location use, so is there anyway I can allow location use in Selenium, or maybe some other way to get exact geographical coordinates

alecxe

Usually, when a site wants to get this kind of data, a browser asks you if you want to share your location. The question is inside a popup which cannot be controlled with selenium. In this case, you need to tell the browser, not to open the popup and allow to share your location at the same time so that the popup would not be opened in the first place.

For Firefox, you need to:

  • open the site
  • allow to share your location (you can also check about:permissions to see the setting)
  • save the current firefox profile
  • start firefox with FirefoxProfile pointing to the profile you've saved before

For more information, see:

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

How can I send a string as NULL to SQLServer using Dapper?

来自分类Dev

Using Gradle, how can I ensure that a file exists at a certain location?

来自分类Dev

how can i switch web pages of the website automatically , which i have created, using javascript?

来自分类Dev

Using UITableView inside Container view for forms - how do I access the form fields?

来自分类Dev

In Puppet, how can I access a variable/attribute inside a defined type?

来自分类Dev

How can I get the x/y location of a touch relative to the entire view when I touch a button?

来自分类Dev

How can I stop controls from using a KeyEvent?

来自分类Dev

PhantomJS; If I set a variable inside page.evaluate(), how can I access the value of that variable outside of page.evaluate()

来自分类Dev

How can I get last inserted id using Hibernate

来自分类Dev

How can I change a word in a buffer using elisp?

来自分类Dev

How to access the link by searching its text in Selenium WebDriver?

来自分类Dev

How can I create a temporary table using PetaPoco?

来自分类Dev

How do i change the location directory of python open document?

来自分类Dev

How am I using copytree wrong and how can I fix it so it doesn't get caught in a huge loop?

来自分类Dev

How can I connect to a postgreSQL database into Apache Spark using scala?

来自分类Dev

How can I center text inside a div element using CSS

来自分类Dev

How to attach pictures using Selenium IDE?

来自分类Dev

How can I stop myself from using 'git commit -a'?

来自分类Dev

How can I work with a .csv file using Java Spring Resttample?

来自分类Dev

How do I reprompt to allow user to continue converting values?

来自分类Dev

How to set proxy authentication in PhantomJS using selenium?

来自分类Dev

Why can I access a protected method in a test?

来自分类Dev

Can I Access Parameters of a Computation Expression?

来自分类Dev

How can I get the current weekday in Rust using the Chrono crate?

来自分类Dev

How to keep the weight value to zero in a particular location using theano or lasagne?

来自分类Dev

如何将标题“ Access-Control-Allow-Origin”设置为Selenium Webdriver

来自分类Dev

How to get user location city without using geo location

来自分类Dev

how to extract path from file location using shell

来自分类Dev

How do I allow privileged commands to fail but respond?

Related 相关文章

  1. 1

    How can I send a string as NULL to SQLServer using Dapper?

  2. 2

    Using Gradle, how can I ensure that a file exists at a certain location?

  3. 3

    how can i switch web pages of the website automatically , which i have created, using javascript?

  4. 4

    Using UITableView inside Container view for forms - how do I access the form fields?

  5. 5

    In Puppet, how can I access a variable/attribute inside a defined type?

  6. 6

    How can I get the x/y location of a touch relative to the entire view when I touch a button?

  7. 7

    How can I stop controls from using a KeyEvent?

  8. 8

    PhantomJS; If I set a variable inside page.evaluate(), how can I access the value of that variable outside of page.evaluate()

  9. 9

    How can I get last inserted id using Hibernate

  10. 10

    How can I change a word in a buffer using elisp?

  11. 11

    How to access the link by searching its text in Selenium WebDriver?

  12. 12

    How can I create a temporary table using PetaPoco?

  13. 13

    How do i change the location directory of python open document?

  14. 14

    How am I using copytree wrong and how can I fix it so it doesn't get caught in a huge loop?

  15. 15

    How can I connect to a postgreSQL database into Apache Spark using scala?

  16. 16

    How can I center text inside a div element using CSS

  17. 17

    How to attach pictures using Selenium IDE?

  18. 18

    How can I stop myself from using 'git commit -a'?

  19. 19

    How can I work with a .csv file using Java Spring Resttample?

  20. 20

    How do I reprompt to allow user to continue converting values?

  21. 21

    How to set proxy authentication in PhantomJS using selenium?

  22. 22

    Why can I access a protected method in a test?

  23. 23

    Can I Access Parameters of a Computation Expression?

  24. 24

    How can I get the current weekday in Rust using the Chrono crate?

  25. 25

    How to keep the weight value to zero in a particular location using theano or lasagne?

  26. 26

    如何将标题“ Access-Control-Allow-Origin”设置为Selenium Webdriver

  27. 27

    How to get user location city without using geo location

  28. 28

    how to extract path from file location using shell

  29. 29

    How do I allow privileged commands to fail but respond?

热门标签

归档