-
pypiwin32 使用手册_selenium使用pypiwin32库上传文件
2020-12-24 02:22:15在学习selenium自动化测试中,遇到文件上传,书的作者轻轻跳过,回避了实际...安装pypiwin32库: pip install pypiwin32参考https://www.cnblogs.com/linuxchao/p/linuxchao-selenium-upload_file.html===========...在学习selenium自动化测试中,遇到文件上传,书的作者轻轻跳过,回避了实际工作要求。
本着从实际出发的想法,在网上查了些资料,最终使用win32库完成文件上传。
安装pypiwin32库: pip install pypiwin32
参考https://www.cnblogs.com/linuxchao/p/linuxchao-selenium-upload_file.html
===============================================================
回归正题,下面的内容是实操代码,希望注释能把事情描述的更清楚些。
import win32con
import win32gui
from time import sleep
from selenium.webdriver.common.action_chains import ActionChains
from selenium import webdriver
def uploadFile(browser:str,file:str):
# 浏览器打开的窗口 标题名称有区别
browser_type = {
'firefox':'文件上传',
'chrome':'打开',
'ie':'选择要加载的文件'
}
sleep(2)
# 使用工具WinSpy,定位“打开”窗口,class是 #32770
dialog = win32gui.FindWindow('#32770',browser_type[browser])
# 需要一级一级找子窗口edit;;;在工具WinSpy右侧可以看到“打开”窗口的结构:#32770 “打开”---ComboBoxEx32---ComboBox---Edit
ComboBoxEx32 = win32gui.FindWindowEx(dialog,0,"ComboBoxEx32",None)
ComboBox = win32gui.FindWindowEx(ComboBoxEx32,0,"ComboBox",None)
edit = win32gui.FindWindowEx(ComboBox,0,"Edit",None)
button = win32gui.FindWindowEx(dialog,0,"Button",None)
win32gui.SendMessage(edit,win32con.WM_SETTEXT,None,file)
win32gui.SendMessage(dialog,win32con.WM_COMMAND,1,button)
if __name__ == '__main__':
driver = webdriver.Chrome()
driver.get(r'C:\Users\Administrator\PycharmProjects\webAutoTest\upload_file.html')
element = driver.find_element_by_xpath('//*[@id="upload_file"]')
action = ActionChains(driver)
action.move_to_element(element).click().perform()
action.release()
sleep(3)
uploadFile('chrome',r'C:\driver\chromedriver 64b.exe')
sleep(3)
driver.quit()
-
pypiwin32安装
2018-12-22 20:11:50 -
change win32 dependence from pypiwin32 to pywin32
2021-01-06 09:59:16<p>pypi.org has Feb 26, 2018 as latest for pypiwin32. pypi.org has Jun 13, 2020 as latest for pywin32. </li><li> <p>Looks like circa 2016 pypiwin32 was an offered repackaging of pywin32 to use wheels.... -
Windows安装pypiwin32
2019-11-29 12:01:03使用python -m pip install pypiwin32,这个...python -m pip install pypiwin32 出现如下错误提示 File "C:\Users\zhangshengfan\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\_vendor\urlli...使用python -m pip install pypiwin32,这个模块就包含win32com
python -m pip install pypiwin32
出现如下错误提示
File "C:\Users\zhangshengfan\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\_vendor\urllib3\respons e.py", line 307, in _error_catcher raise ReadTimeoutError(self._pool, None, 'Read timed out.') pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. You are using pip version 9.0.3, however version 19.3.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.
按照提示upgrading
python -m pip install --upgrade pip
再次安装pypiwin32
-
Could not install pypiwin32
2020-12-08 21:27:54I could install pypiwin32, I tried sudo pip3 install pypiwin32 but it shows this error: <p>Collecting pywin32 Could not find a version that satisfies the requirement pywin32 (from versions: ) No ... -
Problem with pypiwin32 dependency
2020-12-09 01:53:35in my project (which requires <code>fmpy</code> in its setuptools config), setuptools fails because it cannot find the dependency <code>pypiwin32</code> (there is only <code>pywin32</code> installed).... -
Add recipe for pypiwin32
2020-12-25 19:59:14<div><p><code>pypiwin32</code> is needed for some windows 32 extensions. The only packages available are wheels.</p><p>该提问来源于开源项目:conda-forge/staged-recipes</p></div> -
pip install pypiwin32
2018-04-29 15:55:24windows系统上出现这个问题的解决需要安装Py32Win模块,做法是:pip install pypiwin32windows系统上出现这个问题的解决需要安装Py32Win模块,
做法是:
pip install pypiwin32
-
pywin32 does not publish a python3 wheel, breaking pypiwin32
2021-01-07 04:40:25t sure where to post this, since pypiwin32 doesn't seem to have its own home, but pypiwin32 introduced a dependency on pywin32 which either never has, or stopped providing python 3 wheels. This ... -
XP下打包python3.4.4 pyinstaller3.2.1 pypiwin32-219 pywin32-221
2020-02-26 20:56:40压缩包里包含python3.4.4 、pyinstaller3.2.1 、pypiwin32-219 、pywin32-221 ,还有一个XP下搭建打包环境的教程!!! -
setup: remove pypiwin32 dependency
2020-12-02 01:20:48<div><p>pypiwin32 is quite a large dependency that isn't needed.</p><p>该提问来源于开源项目:frerich/clcache</p></div> -
pypiwin32安装失败
2019-01-08 13:46:29Scrapy 用的pypiwin32 环境 Python 3.6.3 :: Anaconda, Inc. pip 18.1 from c:\programdata\anaconda3\lib\site-packages\pip (python 3.6) windows 10 家庭版(1804) 首先查看错误是否一样 以及python版本是否... -
完美解决pyinstaller打包报错找不到依赖pypiwin32或pywin32-ctypes的错误
2020-12-20 09:04:58但是运行pip install pypiwin32时却提示两个库都已经安装过了 可是当再运行打包脚本时就是死活无法打包,就是提示缺少上面两个依赖库。 各种度娘发现都没有遇到类似奇葩情况的。 于是决定自行解决,首先根据错误... -
pypiwin32 使用手册_安装pypiwin32后未满足pywin32要求
2020-12-24 02:21:07尝试使用pip安装Python...需求中存在pywin32包,因此我们得到一个错误:C:\Windows\system32>pip install pyadCollecting pyadUsing cached pyad-0.5.16.tar.gzRequirement already satisfied: setuptools in c:\... -
Problem when installing pypiwin32/pywin32 and privoxy.service
2020-12-01 21:42:52<p>I have a problem when running cape2.sh base cape, during installing, it could not install pypiwin32/pywin32 and privoxy (on mongodb-server). So I need your support, I appreciate about your help! ... -
import win32api 安装pip install pypiwin32
2018-04-21 09:41:06如下: Could not find a version that satisfies the requirement win32api (from versions: ) No matching distribution found for win32api改为pip install pypiwin32... -
pypiwin32 version 222 - Failed to be installed
2021-01-07 04:54:27<div><p>New version of pypiwin32 (version 222) updated on 25-1-2018 cannot be installed. <p>Sometimes, package is being installed, however when trying to import "win32api" module, an exception... -
【求助】安装和使用pywin32 pypiwin32遇到问题
2019-06-13 00:06:10本人小白,还望各位...cmd中使用pip install pywin32 和pip install pypiwin32安装,均提示Successfully installed 但是在pycharm中import win32gui 和 import win32con 都报错,想知道有什么解决办法? 感谢! ... -
Unable to install pypiwin32 on python 2.7
2021-01-07 04:43:30pip install pypiwin32-219.zip Unpacking c:\users\abc\downloads\pypiwin32-219.zip Running setup.py (path:c:\users\abc\appdata\local\temp\pip-v9iuar-build\s etup.py) egg_info for package from file:///C... -
pypi "pypiwin32" points back to the wrong sourceforge project
2021-01-07 04:45:58<div><p>https://pypi.python.org/pypi/pypiwin32 points back to "http://sourceforge.net/projects/pypiwin32/" instead of "http://sourceforge.net/projects/pywin32/" <p>Reported by: ... -
python 阻止程序并行运行(pypiwin32模块)
2020-06-28 21:45:49互斥量: 采用互斥对象机制。...这里使用的是windows的互斥量,使用前需要安装pypiwin32模块 pip install pypiwin32 使用win32event.CreateMutex创建锁,在当前进程结束后自动释放锁,保证在同一时刻只有一个程序示 -
Error while installing pypiwin32-219.win32-py2.7.exe
2020-12-08 20:03:33m installing pypiwin32-219.win32-py2.7.exe Thanks <img alt="python error" src="https://img-blog.csdnimg.cn/img_convert/ea266c8fe9e33484c98c8a2ac1294089.png" /></p>该提问来源于开源项目:sithis993... -
specified a version for pypiwin32 and moved it to install_requires
2020-11-30 09:15:39<p><code>pypiwin32</code> did not have a version number. <h3>How was it fixed? <p>specified a version for pypiwin32 and moved it to install_requires. <p>I have tested this change on a windows machine.... -
include python3-pypiwin32 in windows standalone installer
2021-01-10 21:03:37<p>would it be possible, that you include the python3-pypiwin32 site package in the qgis standalone installer for the next PR 3.0.2? <p>thanks! <p>Related issue(s): #18899 (relates) Redmine related ... -
pypiwin32 复制sheet 到另一个工作薄
2020-07-22 17:57:45pip install pypiwin32 pip install openpyxl 2、代码 import os from openpyxl import Workbook dirname = os.path.abspath('.') excel = win32.DispatchEx('Excel.Application') excel.Visible = False excel.... -
完美解决pyinstaller 打包报错找不到依赖pypiwin32 或pywin32-ctypes的错误
2020-01-14 16:09:30报错信息 最近闲来无事,用python的tkinter库开发了一款带日程提醒的万年历桌面程序。在程序开发结束开始打包时,却发现一直报错 PyInstaller cannot check for ...pip install pypiwin32 但是运行pip inst... -
windows7环境下 安装pypiwin32模块及消息提示框功能详解
2019-01-28 17:53:331.安装pypiwin32 https://pypi.org/project/pypiwin32/#files 下载安装包 在通过pip3 install pypiwin32-223-py3-none-any.whl 这个在windows平台下支持2 第一个是win32gui,这个模块内定义了一些有关图形操作的API... -
Replace pypiwin32 with pywin32
2020-11-25 22:44:10<div><p>Fixes: ticket:2392 <p>This change is <a href="https://reviewable.io/reviews/tahoe-lafs/tahoe-lafs/685"><img src=...该提问来源于开源项目:tahoe-lafs/tahoe-lafs</p></div> -
Breaking change for docker-py with release of pypiwin32 (222) (Windows only)
2021-01-12 10:15:40<div><p>On Windows there appears to be a breaking change with the release of version 222 of pypiwin32 <a href="https://pypi.python.org/pypi/pypiwin32">https://pypi.python.org/pypi/pypiwin32</a> ...
-
Sqlite.rar
-
读取excel数据生成heighcharts速度曲线.zip
-
flutter实战!Android工程师面试该怎么准备?附面试题答案
-
GooglePinyinInstaller_x64.exe
-
【数据分析-随到随学】机器学习模型及应用
-
FFmpeg4.3黄金系列课程:c++版
-
大数据Hive on MR/TEZ与hadoop的整合应用
-
粉红荷花美容中心网页模板
-
第8章 集成运放负反馈放大电路
-
Android 基础基类的运用学习
-
AnyTXT.Searcher.1.2.270.exe
-
学习培训互动平台网页模板
-
注解
-
python数据分析基础
-
在Bbedit中使用正则表达式的小技巧
-
Kotlin协程极简入门与解密
-
单片机完全学习课程全五季套餐
-
ijkplayer_so_0.8.8.rar
-
ProBuilder快速原型开发技术
-
不使用flash player播放器,只使用html5+javascript实现js播放.flv视频.zip