JavaScript
x
4
1
tos = driver.find_element_by_id("TOS_CHECKBOX").click()
2
check_out = driver.find_element_by_class_name("btn btn--small-wide")
3
check_out.click()
4
Link to website: https://www.squidindustries.co/cart
I’m able to check the terms of service box but then when I try to click the checkout button I am given an error of “no such element: Unable to locate element: {“method”:”css selector”,”selector”:”.btn btn–small-wide”}” I’ve tried time.sleep and driver.implicitly_wait but neither seem to work. Any ideas?
Advertisement
Answer
You can use the below css :
JavaScript
1
2
1
input[value='Check out']
2
in code :
JavaScript
1
3
1
check_out = driver.find_element_by_css_selector("input[value='Check out']")
2
check_out.click()
3
or
With Explicit waits :
JavaScript
1
3
1
checkout = WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"input[value='Check out']")))
2
checkout.click()
3
Imports :
JavaScript
1
4
1
from selenium.webdriver.support.ui import WebDriverWait
2
from selenium.webdriver.common.by import By
3
from selenium.webdriver.support import expected_conditions as EC
4