CSS Ribbon

Reproducing the GitHub Ribbon in CSS

自动化登录--人类的一小步

# from selenium import webdriver
#
# driver = webdriver.Firefox()
# url = 'http://www.caifupad.com/'
# driver.get(url)
#
# tt = driver.find_element_by_id('unlogin1').get_attribute('name')
# pp = driver.find_element_by_xpath(".//*[@id='pwlogin_txt']").get_attribute('name')
# driver.find_element_by_link_text('登录').click()
# print(tt)
# print(pp)
# print('########################')
#
# #driver.find_element_by_id("unlogin").clear()
# driver.find_element_by_xpath(".//*[@id='unlogin1']").send_keys('xxxx')
#
# #driver.find_element_by_xpath(".//*[@id='pwlogin']").clear()
# driver.find_element_by_xpath(".//*[@id='pwlogin_txt']").send_keys('XXXXXX')
#
# driver.find_element_by_xpath(".//*[@id='submit-login']").click()
#————————————————————————————————————————————————————#
#错误代码:发生的问题,能打开网页但是不能输入网址,chromedrive的环境变量已经配置完成
# from selenium import webdriver
# import os
# import socket
# import time
# ipAddress = socket.gethostbyname("202.108.22.5")
# print(ipAddress)
# if ipAddress == '202.108.22.5':
# ChromeDriver = r'C:\Users\g\AppData\Local\Google\Chrome\Application\chrome.exe'
# os.environ['driver'] = ChromeDriver
# browser = webdriver.Chrome(ChromeDriver)
# browser.get('www.baidu.com')
# print(ChromeDriver.title)
# else:
# time.sleep(3)
# print('网络连通')
#
# ————————修改方案——————————————————
# from selenium import webdriver
# driver = webdriver.Chrome()
# driver.get("http://www.baidu.com")
#————————————————————————————————————————————————————#
from selenium import webdriver
import socket
import time
from selenium.webdriver.common.keys import Keys
ipAddress = socket.gethostbyname("202.108.22.5")
print(ipAddress)
if ipAddress != '202.108.22.5':
ChromeDriver = webdriver.Chrome()
ChromeDriver.get("http://10.30.4.5/webAuth")
print('网页的名称是>>%s'%ChromeDriver.title)
user = ChromeDriver.find_element_by_id("username") # 审查元素username的id
user.send_keys("8340") # 输入账号
password = ChromeDriver.find_element_by_name("password") # 审查元素password的name
password.send_keys("2017") # 输入密码
password.send_keys(Keys.RETURN) # 实现自动点击登陆
print('登陆成功')
else:
time.sleep(3)
print('网络连通,不需要自动化代理')



posted on 2018-03-31 16:30  pandaboy1123  阅读(156)  评论(0编辑  收藏  举报

导航