码迷,mamicode.com
首页 > 编程语言 > 详细

selenium-1-python

时间:2019-11-23 09:20:07      阅读:81      评论:0      收藏:0      [点我收藏+]

标签:pat   find   https   win32   type   com   fir   exe   自动登录   

python selenium

from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.select import Select
import time
path = r'D:\selenium\chromedriver_win32\chromedriver.exe'

链接跳转
def ithome():
    driver = webdriver.Chrome(path)
    driver.get('https://www.ithome.com')
    driver.find_element_by_css_selector('div.clearfix > div:nth-of-type(1) > a:first-child').click()
    time.sleep(1)
    driver.quit()

OA自动登录
def oalogon():
    driver = webdriver.Chrome(path)
    driver.get('http://ip/login/Login.jsp?logintype=1')
    driver.find_element_by_name('loginid').send_keys('user')
    driver.find_element_by_name('userpassword').send_keys('password')
    driver.find_element_by_css_selector('#login').click()
    driver.quit()

selenium-1-python

标签:pat   find   https   win32   type   com   fir   exe   自动登录   

原文地址:https://www.cnblogs.com/kylingx/p/11915213.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!