如何实现 Python 中 selnium 模块的换行
如何实现 Python 中 selnium 模块的换行
三种方法:
直接调用 .submit() 方法,常使用在用户密码登录中
# driver.find_element_by_xpath('//*[@id="tree-finder-field"]').submit()
使用系统换行符,缺陷受限
# driver.find_element_by_xpath('//*[@id="tree-finder-field"]').send_keys('\r\n','\n')
Text files created on DOS/Windows machines have different line endings than files created on Unix/Linux. DOS uses carriage return and line feed ("\r\n") as a line ending, which Unix uses just line feed ("\n"). You need to be careful about transferring files between Windows machines and Unix machines to make sure the line endings are translated properly.
调用自带类,键盘模拟种类全
from selenium.webdriver.common.keys import Keys
driver.find_element_by_xpath('//*[@id="login"]/form/div[4]/input[3]').send_keys(Keys.ENTER)
但是!不管使用哪种方法,都需要 time.sleep 让系统停下会,不然永远不生效(尤其是信息搜索的时候)
参考:
http://www.cs.toronto.edu/~krueger/csc209h/tut/line-endings.html
https://stackoverflow.com/
该小技巧使用在lctt-cli项目
如何实现 Python 中 selnium 模块的换行的更多相关文章
- Python中optionParser模块的使用方法[转]
本文以实例形式较为详尽的讲述了Python中optionParser模块的使用方法,对于深入学习Python有很好的借鉴价值.分享给大家供大家参考之用.具体分析如下: 一般来说,Python中有两个内 ...
- python中导入模块的本质, 无法导入手写模块的解决办法
最近身边一些朋友发生在项目当中编写自己模块,导入的时候无法导入的问题. 下面我来分享一下关于python中导入模块的一些基本知识. 1 导入模块时寻找路径 在每一个运行的python程序当中,都维护了 ...
- 正则表达式与Python中re模块的使用
正则表达式与Python中re模块的使用 最近做了点爬虫,正则表达式使用的非常多,用Python做的话会用到re模块. 本文总结一下正则表达式与re模块的基础与使用. 另外,给大家介绍一个在线测试正则 ...
- python中os模块中文帮助
python中os模块中文帮助 python中os模块中文帮助文档文章分类:Python编程 python中os模块中文帮助文档 翻译者:butalnd 翻译于2010.1.7——2010.1.8 ...
- python中threading模块详解(一)
python中threading模块详解(一) 来源 http://blog.chinaunix.net/uid-27571599-id-3484048.html threading提供了一个比thr ...
- 【转】关于python中re模块split方法的使用
注:最近在研究文本处理,需要用到正则切割文本,所以收索到了这篇文章,很有用,谢谢原作者. 原址:http://blog.sciencenet.cn/blog-314114-775285.html 关于 ...
- Python中的模块介绍和使用
在Python中有一个概念叫做模块(module),这个和C语言中的头文件以及Java中的包很类似,比如在Python中要调用sqrt函数,必须用import关键字引入math这个模块,下面就来了解一 ...
- Python中time模块详解
Python中time模块详解 在平常的代码中,我们常常需要与时间打交道.在Python中,与时间处理有关的模块就包括:time,datetime以及calendar.这篇文章,主要讲解time模块. ...
- Python中collections模块
目录 Python中collections模块 Counter defaultdict OrderedDict namedtuple deque ChainMap Python中collections ...
随机推荐
- 125. Valid Palindrome (Array; Two-Pointers)
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignori ...
- 本地SQL查询
-------------------siwuxie095 本地 SQL 查询 1.简单介绍 采用 HQL 或 QBC 查询时,Hibernate 生成标准的 SQL 语句, 适用于所有的数据库平台, ...
- ubuntu18(笔记本) faster-rcnn实例程序运行
luo@luo-ThinkPad-W540:TensorflowProject$ source activate flappbird (flappbird) luo@luo-ThinkPad-W540 ...
- CloudStack 初始化执行命令流分析
查询路由元素 选择可以使用的路由元素 需要将网络服务提供者的:虚拟路由和安全同时启用 { "createnetworkresponse" : { ...
- Java泛型中的通配符
Java泛型中的通配符可以直接定义泛型类型的参数.而不用把该函数定义成泛型函数. public class GenericsTest { public static void main(String[ ...
- Luogu 4726 【模板】多项式指数函数
补补补…… 这个题的解法让我认识到了泰勒展开的美妙之处. 泰勒展开 泰勒展开就是用一个多项式型的函数去逼近一个难以准确描述的函数. 有公式 $$f(x)\approx g(x) = g(x_0) + ...
- 【#】Spring3 MVC 注解(二)---@RequestMapping
博客分类: spring MVC 1 问题:有多个 @RequestMapping @controller @RequestMapping("/aaa") ...
- smarty类与对象的赋值与使用
<?phprequire_once('../smarty/Smarty.class.php'); //配置信息$smarty=new Smarty(); $smarty->left_del ...
- twitter集成第三方登录是窗口一直出现闪退的解决方法
需要创建自己的token,如下图
- [GO]并的爬取捧腹的段子
package main import ( "fmt" "strconv" "net/http" "regexp" &q ...