【发布时间】:2019-08-11 21:32:56
【问题描述】:
选择其他格式(例如 100 CT)时,会显示新价格。复制该 URL 并导航到它,注意它重定向回原来的 10 CT 页面。
我想知道 100 CT 页面上的价格。
这是我的代码,它点击了正确的格式,但是当我尝试重新获取 url 时,我仍然得到 10 CT 页面。
format_header = browser.find_element_by_css_selector("ul.--horizontalScroll.gbcvs-c-variantSelectorList")
items = format_header.find_elements_by_tag_name('li')
format_count = 1
for item in items:
text = item.text
if(text == '100 CT'):
break
else:
format_count += 1
browser.find_element_by_xpath("(.//*[normalize-space(text()) and normalize-space(.)='Count:'])[1]/following::label["+str(format_count)+"]").click()
print(browser.current_url)
browser.get(browser.current_url)
【问题讨论】:
标签: python selenium url-redirection