jeudi 28 janvier 2016

How to use Selenium to get the parking price?

I'm trying to use web scraping to get the parking price at this link, http://ift.tt/1Qvzic3. It's $2 for the day which is what I'm trying to get. I'm using python+selenium, but just couldn't get the parking price. Below is the code I'm using, but sometimes I hit the target but most time I get the error selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"class name","selector":"gwt-RadioButton"}. Can anyone help? thanks in advance

def downtownparking(driver):
driver.get("http://ift.tt/1Qvzic3")
try:
    ### driver.wait = WebDriverWait(driver, 16)
    ### driver.implicitly_wait(20)
    cr = driver.find_element_by_class_name("gwt-RadioButton")
    dayprice = cr.find_element_by_tag_name("label")
    print (dayprice.text)




Aucun commentaire:

Enregistrer un commentaire