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 @   anobscureretreat  阅读(93)  评论(0编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
历史上的今天:
2018-12-28 python 断言
2018-12-28 wireshark 下载 安装使用
2018-12-28 python 连加
2018-12-28 python 阶乘
2018-12-28 python input输入元素相加
2018-12-28 python input选择
2018-12-28 python 数据交换
点击右上角即可分享
微信分享提示