无法使用Selenium点击虾皮上的结账按钮



尝试点击此商店结帐按钮。无法继续到下一个过程。这是html元素

html:

<button class="shopee-button-solid shopee-button-solid--primary " xpath="1"><span class="pcmall-cart_1FvSs2">checkout</span></button>

有一个my code:

def click(browser,element_css):
WebDriverWait(browser,60).until(
ec.visibility_of_element_located((By.CSS_SELECTOR, element_css)))

WebDriverWait(browser,60).until(
ec.element_to_be_clickable((By.CSS_SELECTOR, element_css))
)
browser.find_element_by_css_selector(element_css).click()

click(browser,'.shopee-button-solid')
wait.until(
ec.presence_of_element_located((By.CSS_SELECTOR,'.loading-spinner-popup'))
)

错误代码python selenium:

selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <button class="shopee-button-solid shopee-button-solid--primary ">...</button> is not clickable at point (984, 524). Other element would receive the click: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 22" class="chat-icon">...</svg>

它不再工作,按钮不被点击。有办法解决这个问题吗?

你可以用explicitWait

check_out = WebDriverWait(driver,10).until(EC.presence_of_element_located((By.XPATH,"")))
check_out.click()

代码可以写成

check_out = WebDriverWait(driver,10).until(EC.presence_of_element_located((By.XPATH,"//*[@id="main"]/div/div[2]/div[2]/div/div[3]/div[2]/div[7]/button[4]")))
check_out.click()

相关内容

  • 没有找到相关文章

最新更新