使用Selenium python打开USA Clothing网站会将我重定向到Europe Clothing Website主页

时间:2018-12-31 19:30:27

标签: python url redirect selenium-webdriver https

当尝试打开某个显示带有selenium-python的外套的URL时,该页面会自动将我重定向到欧洲主屏幕

在这里我的密码(美国商店)

URL = 'https://shop-usa.palaceskateboards.com/products/reversible-spherie-jacket-gold-petrol'
browser = webdriver.Chrome()
browser.get(URL)
webbrowser.open(URL)

打开网址后,该网站便将我重定向到该网址(欧洲商店)

  

https://shop.palaceskateboards.com/

是否要阻止它重定向我?

1 个答案:

答案 0 :(得分:0)

禁用javascript

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_experimental_option( "prefs",{'profile.managed_default_content_settings.javascript': 2})
browser = webdriver.Chrome(executable_path='/path/to/chromedriver',chrome_options=chrome_options)
url='https://shop-usa.palaceskateboards.com/products/reversible-spherie-jacket-gold-petrol'
browser.get(url)