淘先锋技术网

首页 1 2 3 4 5 6 7
from find_element.capability import driver,NoSuchElementException

try:
    driver.find_element_by_id('net.csdnplus:id/llnightmode')
except NoSuchElementException:
    print('未走登陆的进入博客')
    driver.find_element_by_id('net.csdnplus:id/slidBack').click()
    driver.find_element_by_id('net.csdnplus:id/ll_info').click()
    #class元素相对定位--先定位父元素再从父元素中定位元素
    root_element=driver.find_element_by_class_name('android.widget.LinearLayout')
    root_element.find_element_by_class_name('android.widget.ImageView')
else:
    print('已走登陆的进入论坛')
    driver.find_element_by_id('net.csdnplus:id/slidBack').click()
    driver.find_element_by_id('net.csdnplus:id/ll_bbs').click()