python selenium教程

Posted xiluhua

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python selenium教程相关的知识,希望对你有一定的参考价值。

退出Windows终端python交互模式

Ctrl + Z + Enter

 

参考:https://jingyan.baidu.com/article/495ba841d4200438b20ede53.html

环境: windows10

1. 安装 Python

https://www.python.org/

 1.1. 下载免安装版:

 

 1.2. 配置 path

 

 1.3. 安装成功

或者

 

 

2. selenium安装:

pip install selenium
  • 权限问题

解决:https://www.cnblogs.com/liaojiafa/p/5100550.html

Exception:
Traceback (most recent call last):
  File "c:\\program files\\python35\\lib\\site-packages\\pip\\basecommand.py", line 21
1, in main
    status = self.run(options, args)
  File "c:\\program files\\python35\\lib\\site-packages\\pip\\commands\\install.py", li
ne 311, in run
    root=options.root_path,
  File "c:\\program files\\python35\\lib\\site-packages\\pip\\req\\req_set.py", line 64
6, in install
    **kwargs
  File "c:\\program files\\python35\\lib\\site-packages\\pip\\req\\req_install.py", lin
e 803, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "c:\\program files\\python35\\lib\\site-packages\\pip\\req\\req_install.py", lin
e 998, in move_wheel_files
    isolated=self.isolated,
  File "c:\\program files\\python35\\lib\\site-packages\\pip\\wheel.py", line 339, in
move_wheel_files
    clobber(source, lib_dir, True)
  File "c:\\program files\\python35\\lib\\site-packages\\pip\\wheel.py", line 310, in
clobber
    ensure_dir(destdir)
  File "c:\\program files\\python35\\lib\\site-packages\\pip\\utils\\__init__.py", line
 71, in ensure_dir
    os.makedirs(path)
  File "c:\\program files\\python35\\lib\\os.py", line 241, in makedirs
    mkdir(name, mode)
PermissionError: [WinError 5] 拒绝访问。: \'c:\\\\program files\\\\python35\\\\Lib\\\\sit
e-packages\\\\xlwt\'

 

3. 浏览器驱动配置(Chrome)

http://chromedriver.storage.googleapis.com/index.html

将 chromedriver.exe 直接 copy 到如下 python 解释器的安装目录

 

以上是关于python selenium教程的主要内容,如果未能解决你的问题,请参考以下文章

Selenium Xpath元素无法定位 NoSuchElementException: Message: no such element: Unable to locate element(代码片段

Python+Selenium做到浏览器所见即所得(全网最简单教程)

Python+Selenium做到浏览器所见即所得(全网最简单教程)

Python Selenium-使用YouTube调试简单代码

基于Python+selenium+Chrome的网页自动化教程

selenium+python做web端自动化测试框架与实例详解教程