惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Fortinet All Blogs
Attack and Defense Labs
Attack and Defense Labs
V2EX - 技术
V2EX - 技术
O
OpenAI News
S
Secure Thoughts
H
Heimdal Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Schneier on Security
Schneier on Security
H
Hacker News: Front Page
S
Security Affairs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
The Register - Security
The Register - Security
GbyAI
GbyAI
Cloudbric
Cloudbric
MongoDB | Blog
MongoDB | Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
K
Kaspersky official blog
Forbes - Security
Forbes - Security
Y
Y Combinator Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Scott Helme
Scott Helme
Hacker News - Newest:
Hacker News - Newest: "LLM"
The Cloudflare Blog
Recorded Future
Recorded Future
人人都是产品经理
人人都是产品经理
Cyberwarzone
Cyberwarzone
C
CERT Recently Published Vulnerability Notes
Webroot Blog
Webroot Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LangChain Blog
T
Tor Project blog
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
Hacker News: Ask HN
Hacker News: Ask HN
Blog — PlanetScale
Blog — PlanetScale
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
N
News and Events Feed by Topic
阮一峰的网络日志
阮一峰的网络日志
I
Intezer
V
V2EX
T
Tailwind CSS Blog
SecWiki News
SecWiki News
NISL@THU
NISL@THU
C
Check Point Blog

博客园 - 懒牛拉车

xxx tmp Thinkphp 3.2 Cookie丢失导致中英文混排 Nginx配置文件下载 每次用npm都很烦人 js 判断mac地址是否为组播地址 项目在本地时,css/js文件在浏览器刷新时,从(memory cache)读取,放服务器上就不会 模拟json_decode解析非法utf-8编码字符串 php socket 循环ping ip,显示能ping通的IP地址 thinkphp3.2.2 CheckLangBehavior.class中,使用session无效原因分析 Thikphp 3.2 session页面传递失败问题 火狐autocomplete="off"无效 testlink windows 安装笔记 宝塔面板部署thinkcmf问题 coreseek 測試用例 coreseek 基与Sphinx 的全文索引 centos6 nginx 配置本地https访问 centos6 nginx安装好以后,添加拓展ssl centos6 php7 安装 memcache 和 memcached - 懒牛拉车 centos7 搭建 php7 + nginx (2) - 懒牛拉车 centos7 搭建 php7 + nginx (1)
第一个python自动化实例
懒牛拉车 · 2022-07-20 · via 博客园 - 懒牛拉车
  1. 下载python安装

  2. 验证是否安装pip

python -m pip --version
输出如下,表示安装
pip 19.2.3 from C:\_Program\Python27\lib\site-packages\pip (python 2.7)
  1. 安装selenium
pip install selenium
  1. 查看chrome版本,然后到https://chromedriver.storage.googleapis.com/index.html下载对应的win32.zip
    解压zip文件,放在chrome浏览器根目录下
    验证是否安装:直接在cmd目录下执行chromedriver即可

  2. 配置环境变量,将chrome根目录和python根目录添加到环境变量中。

  3. 添加test.py文件,代码如下

# coding=utf-8

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

class TestTest01():
  def __init__(self):
    self.driver = webdriver.Chrome()
    self.vars = {}

    def over(self):
        self.driver.quit()

	def test_test01(self):
		self.driver.get("https://www.baidu.com/")
		self.driver.set_window_size(1088, 816)
		self.driver.find_element(By.ID, "kw").send_keys("selenium")
		self.driver.find_element(By.ID, "kw").send_keys(Keys.ENTER)

obj = TestTest01()
obj.test_test01()
# obj.over()
  1. cmd窗口运行命令
python test.py