![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
selenium
子非鱼5025
子非鱼焉知鱼之乐
展开
-
python字符串连接也可以使用print时用到的方法
def test_function(str):result1 = "wo%sni" %str# 大多数时候result1==result2,但有时候加号连接找不到元素result2 = "wo"+str+"ni"result3 = "wo%sni" %"ai"test_function("ai")原创 2016-11-22 10:54:06 · 1538 阅读 · 0 评论 -
selenium常见错误的解决思路
元素不可见异常: 发生原因:在寻找到那一刻,该元素的display属性是none 解决思路:使用显式等待。 from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriv原创 2016-11-22 10:55:33 · 1025 阅读 · 0 评论 -
xpath语法
xpath是一种元素定位语言,可以用来定位html中的元素。xpath会用到的符号:// 以匹配的方式选择元素,只能用在开头,如//path,选取页面中的path元素 / 选取节点 [] 封装选择条件或属性或位置,如[1]表示选择第一个元素;[last()]表示选择最后一个元素;[position()<3]代表选择前两个元素 @ 用在属性名前,肯定会写在[]里。如:[@id=’abc’],表示原创 2016-11-22 10:45:29 · 570 阅读 · 0 评论 -
python跨路径调用的三种方法
假设路径结构为: project model count.py new_count.py test.py 现在想要在test.py中调用count.py和new_count.py的方法 方法1: import sys sys.path.append(“./model”) from count import count from n原创 2016-11-22 10:49:11 · 4783 阅读 · 2 评论