<a> tag

时间:2018-09-28 18:41:31

标签: html selenium xpath web-scraping

I'm using Selenium to collect some data from a web page, but i need to scrape a variable that is inside a "a" tag.

This is the HTML code:

<div class="complain-title"> <a ui-sref="businessComplain({ company: 
(result.company.shortname|urlDecorator), productName: 
(complain.title|fullUrlDecorator), productId: complain.id})" title="cobrança 
errada" id="link-complainCardTitle0-company" href="/unicesumar-centro- 
universitario-cesumar/cobranca-errada_Jflshd2Qlq-zpqvM/"> <h2 class="ng- 
binding">cobrança errada</h2> </a> </div>

This class is also inside another class called "complaint-item ng-scope"

Specifically, i need to scrape the "title" variable, because it shows the full title of the component, the text only shows a preview.

I don't have much experience with XPath, so i appreciate if anyone could help.

EDIT: I tried to use the following code:

title = driver.find_element_by_xpath("//div[@class='complain-status-title']")
title_attribute = title.get_attribute("title")

But it doesn't return anything.

0 个答案:

没有答案