Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
358 views
in Technique[技术] by (71.8m points)

Selenium/Chromedriver: Turn off location for a single site

When I run chromedriver, due to my system preferences it turns off "Location" as shown in this image. location being turned off
The problem is an individual site still think my location is allowed. As shown in this image: site thinking location is allowed
When I manually set this drop-down to "block" then I achieve the desired behavior. Any way to do this programmatically? Here is what I've tried adding in the capabilities/preferences from various posts around the internet, none have worked:
--disable-geolocation
--enable-strict-powerful-feature-restrictions
profile.default_content_settings.geolocation: 2
geolocation: 1


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

--deny-permission-prompts

Prevents permission prompts from appearing by denying instead of showing prompts. ?

https://peter.sh/experiments/chromium-command-line-switches/

COuld you try adding this as argument example :7

python ;

options.add_argument('--deny-permission-prompts')

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...