Saw this issue this morning with Adapt BB 2 Mag release:
Failed to click buy button: Message: Element
After a couple of retries, the buy button does scroll into view and eventually get clicked. I've seen this issue on In Stock shoes (in my testing I switch the xpath to "@data-qa='add-to-cart'" instead of "@data-qa='feed-buy-cta"). I've seen the following suggested online to get button into view, but doesn't work for me:
def click_buy_button(driver):
xpath = "//button[@data-qa='feed-buy-cta']"
LOGGER.info("Waiting for buy button to become clickable")
wait_until_clickable(driver, xpath=xpath, duration=10)
**element = driver.find_element_by_xpath(xpath)
driver.execute_script("arguments[0].scrollIntoView(true);" + "window.scrollBy(0,-100);", element)**
LOGGER.info("Clicking buy button")
driver.find_element_by_xpath(xpath).click()
Not sure how to solve this to guarantee button scrolls into view.
Saw this issue this morning with Adapt BB 2 Mag release: Failed to click buy button: Message: Element
After a couple of retries, the buy button does scroll into view and eventually get clicked. I've seen this issue on In Stock shoes (in my testing I switch the xpath to "@data-qa='add-to-cart'" instead of "@data-qa='feed-buy-cta"). I've seen the following suggested online to get button into view, but doesn't work for me:
Not sure how to solve this to guarantee button scrolls into view.