I'm trying to select all the ids which contain coupon-link
keyword with the following script.
from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.Firefox() driver.get("http://udemycoupon.discountsglobal.com/coupon-category/free-2/") elems = driver.find_elements_by_css_selector('[id~=\"coupon-link\"]') print(elems)
But I got an empty list []
as the result. What's wrong with my css_selector?
I've tested that find_elements_by_css_selector('[id=\"coupon-link-92654\"]')
works successfully. But I want to select all the coupon-links, not just one of them.
I referenced the document at w3schools.com.