python环境通过selenium实现自动化web登陆及终端邀请

自动化主要的就是识别对象,可以在网上搜到各种各样的方法,自行百度。下面仅附上一个简单的例子。

环境搭建参考如下链接:

https://www.cnblogs.com/hepeilinnow/p/10178450.html   

 

代码实现:

#!/usr/bin/env python
# -*- coding:utf-8 -*- from selenium import webdriver import time from selenium.webdriver.common.keys import Keys driver = webdriver.Firefox() # 登陆portal driver.get("http://10.84.3.73/portal/home") driver.maximize_window() time.sleep(1) driver.find_element_by_id("email").send_keys("admin1") time.sleep(1) driver.find_element_by_id("password").send_keys("keda8888") time.sleep(1) driver.find_element_by_id("remember").click() driver.find_element_by_id("login-submit").click() #进入会议管理系统 time.sleep(1) driver.find_element_by_class_name("module.cmc.show").click() time.sleep(1) driver.get("http://10.84.3.73/meeting/mcc/manager/49") #邀请终端1,若多个终端可复用 driver.find_element_by_class_name("addMtBtn").click() driver.find_element_by_class_name("search_input").send_keys("0512110000400") time.sleep(1) driver.find_element_by_class_name("search_input").send_keys(Keys.ENTER) time.sleep(1) driver.find_element_by_id("orgTree_4_span").click() driver.find_element_by_css_selector("[class='show_call_type call_type']").click() driver.find_element_by_css_selector("[class='call_type_video call_type']").click() time.sleep(1)
driver.find_element_by_css_selector("[class='mt_name mt_ellipsis']").click() driver.find_element_by_css_selector("[class='operate close right']").click() driver.find_element_by_css_selector("[class='self_rate']").clear() driver.find_element_by_css_selector("[class='self_rate']").send_keys(512) driver.find_element_by_css_selector("[class='kd-btn']").click() time.sleep(1) driver.find_element_by_css_selector("[class='btn
ok']").click() #关闭浏览器 driver.quit()

  

posted @ 2018-12-27 15:06  骑白马的猴子  阅读(648)  评论(0编辑  收藏  举报