1
I need to collect text from an angular system, where the element receives 2 CSS classes
<div class="title ng-scope">80</div>
I tested several ways to capture the text, but it does not return (the commented lines shows the attempts)
Python code, using Phantomjs and Selenium below:
from selenium import webdriver
from datetime import datetime
driver = webdriver.PhantomJS()
try:
url_reputacao = driver.get("http://rdash.github.io/#/")
element = driver.find_elements_by_class_name('title ng-scope')
#element = driver.find_element_by_css_selector("title ng-scope")
#element = driver.find_elements_by_css_selector("div[class='title ng-scope']")
#element = driver.find_element_by_css_selector("div.widget-icon green pull-left ng-scope > div.title ng-scope").text
#element = driver.find_element_by_xpath("//div[contains(@class,'title ng-scope')]")
print(element.text)
driver.quit()
except Exception as erro:
data = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
driver.get_screenshot_as_file('screenshot-%s.png' % data)
driver.quit()