Xpath python is not working
Question: hi i am trying to get data from xxx website through python xpath...it just
give me blank data.. i copied the xpath from chrome.. pls let me know what i
am doing wrong here. Thanks you

    
    
    from lxml import html,etree
    import requests
    import urllib2
    def webText(url):
        import urllib2
        response = urllib2.urlopen(url)
        html = response.read()
        return html
    x=webText("http://www.sportscardforum.com/ttm.php?s=3161e010cc6e6fd80ddb2e6b18ab2c5d&do=listp&pl=13450&sp=4");
    f = open("foo.html", "w");
    f.write(x) 
    f.close()
    
    R=open("foo.html").read().strip()
    tree =etree.HTML(R)
    x = tree.xpath('//*[@id="vbulletin_html"]/body/div[2]/table/tbody/tr/td[3]/table[2]/tbody/tr[1]/td/table[2]/tbody/tr[2]/td[2]/table/tbody/tr/td[1]')
    print x
    


Answer: You can use following xpath:

    
    
    //b[contains(text(),'Address:')]/parent::td[1]/following-sibling::td[1]
    

