I want to enter a link in a webpage. This is its location in the inspect element:
As You can see, to reach the link in the < body >, I have to pass through:
1) < div class = “container” >
2) < div id = “result content >
3) < div class=”tabbable tabs-left” >
4) < ul class =”nav… >
There are many < li >, typically I want to collect the hrefs of the class visible phone. The code I have does not prints nothing. What am i doing wrong??
agent = Mechanize.new page = agent.get('http://openie.allenai.org/search?arg1=&rel=contains&arg2=antioxidant&corpora=') array = page.search('//body/div[@id="result-content"]/div[@class="tabbable tabs-left"]/ul[@class="nav nav-tabs"]/li[@class="visible-phone"]/a').each do |x| puts x['href'] end