from selenium import webdriver
driver = webdriver.Chrome()
driver.get('http://www.baidu.com')
driver.implicitly_wait(10)
t = driver.find_element_by_css_selector('a[name="tj_trnews"]')
tx = t.text #获取标签里的值
print(tx)
hf = t.get_attribute('href') #获取元素的属性
print(hf)
tag = t.tag_name #获取标签值
print(tag)
print(t.is_displayed()) #判断元素是否可见
print(driver.name) #浏览器名称
print(t.size) #获取元素的size
print(driver.current_url) #获取当前路径
print(driver.page_source) #获取整个html的源码,可用于爬虫解析等