selenium 练习

code

driver.find_element_by_id('user_name').send_keys('abc')
driver.find_element_by_id('user_pwd').send_keys('icloudeep123')
driver.find_element_by_name('captcha').send_keys('1234')

asleep(driver)

#点击菜单
#asleep(driver)
#driver.find_element_by_xpath(".//div[@class='menu narrow']/div").click()

asleep(driver)
driver.find_element_by_xpath(".//div[@class='aside-menu']/div[3]/div/div/div").click()

asleep(driver)
driver.find_element_by_xpath(".//div[@class='menu-sub menu-sub-active']/ul/li[3]").click()

asleep(driver)
driver.switch_to.frame("iframe-page-content")

asleep(driver)
driver.find_element_by_xpath(".//form[@id='search-form']/div").click()

asleep(driver)
driver.find_element_by_xpath(".//div[@id='address-select-list']/ul/li[3]").click()

asleep(driver)
driver.find_element_by_xpath(".//div[@id='city-select-list']/ul/li[2]").click()

asleep(driver)
driver.find_element_by_xpath(".//div[@id='area-select-list']/ul/li[2]").click()

asleep(driver)
driver.find_element_by_xpath(".//div[@id='street-select-list']/ul/li[3]").click()

'''
asleep(driver)
driver.find_element_by_xpath(".//div[@class='menu-sub menu-sub-active']/ul/li[5]").click()

asleep(driver)
driver.switch_to.frame("iframe-page-content")

#总数
areanum=driver.find_element_by_id("total").text
print(areanum)
#在线
areanum=driver.find_element_by_xpath(".//div[@class='device-situation']/div[1]/div[3]/div[2]/i").text
print(areanum)
#离线
areanum=driver.find_element_by_xpath(".//div[@class='device-situation']/div[2]/div[3]/div[2]/i").text
print(areanum)
#故障
areanum=driver.find_element_by_xpath(".//div[@class='device-situation']/div[3]/div[3]/div[2]/i").text
print(areanum)
#预警
areanum=driver.find_element_by_xpath(".//div[@class='device-situation']/div[4]/div[3]/div[2]/i").text
print(areanum)

driver.switch_to.parent_frame()
driver.close()
'''

 

 

 

 

 

 

 

posted @ 2020-12-28 11:39  anobscureretreat  阅读(89)  评论(0编辑  收藏  举报