
selenium
John.liu_Test
生命源于奋斗,奋斗源于激情,激情源于兴趣
展开
-
Selenium grid 分布式测试搭建
第一步:准备2台电脑,且2台电脑都安装好jdk,都准备好selenium-server-standalone-2.40.0.jar,IEDriver, ChromeDriver等工具,注意chrome版本与chromedriver需要匹配,详见我的另一篇博客:http://www.cnblogs.com/cherrysu/p/7815245.html第二步:其中一台电脑作为hub,也就是老大,另一台作为node,也就是小弟,两台电脑一定要能ping通。第三步:hub机上新建HUB.bat, 内容参考原创 2021-02-25 17:33:33 · 127 阅读 · 0 评论 -
WebDriverWait问题相关
presence_of_element_located: 当我们不关心元素是否可见,只关心元素是否存在在页面中。 visibility_of_element_located: 当我们需要找到元素,并且该元素也可见。原创 2021-02-08 17:03:49 · 332 阅读 · 0 评论 -
python xpath定位和css定位对比
xpath定位和css定位对比xpath常见的定位方法xpath定位和css定位对比实际项目中使用较多的是xpath定位和css定位。XPath是XML文档中查找结点的语法,换句话就是通过元素的路径来查找这个元素。xpath比较强大,而css选择器在性能上更优,运行速度更快,语法上更简洁。比较两种方法:直接子元素XPATH中的直接子元素是使用“/”定义的,而在CSS上,它是使用“>”定义的。XPATH://div/inputCSS: div>input后代元素如转载 2021-02-08 11:10:01 · 1241 阅读 · 0 评论 -
解决Chrome插件安装时出现的“程序包无效”问题-XPath Helper
1.把crx后缀名改为rar,解压缩得到文件夹(有错误提示不用理会),选择全部替换即可2、打开该文件夹,把里面的"_metadata"文件夹改名为"metadata"(去掉下杠)3、进入扩展程序中心,启用开发者模式,加载正在开发的程序包,选择刚才的文件夹就行了,搞定!进入扩展插件目录后(chrome://extensions)加载已解压的扩展程序...原创 2021-02-02 15:57:14 · 344 阅读 · 0 评论 -
chrome无头模式
chrome_options = Options() chrome_options.add_argument('--headless') chrome_options.add_argument('--disable-gpu') dr = webdriver.Chrome(chrome_options=chrome_options) dr.get("https://lbs.amap.com/console/show/picker")原创 2021-01-30 21:25:03 · 818 阅读 · 0 评论 -
selenium3之selenium-server-standalone-3.8.1.jar启动
查看安装的selenium版本下载对应版本的selenium server下载地址:http://selenium-release.storage.googleapis.com/index.html需要先安装JDK(自行百度安装),启动selenium server(如果打不开,查看是否端口被占 用:netstat -aon|findstr 4444):浏览器地址栏输入: localhost:4444点击“console”,然后单击“view config”。将显示hub转载 2020-10-20 09:17:28 · 776 阅读 · 0 评论 -
phantomjs下载地址
https://phantomjs.org/download.html原创 2020-01-07 09:31:58 · 400 阅读 · 0 评论 -
爬取淘宝商品信息demo
from selenium import webdriverfrom selenium.common.exceptions import NoSuchElementExceptionimport timedr = webdriver.Chrome()# dr = webdriver.PhantomJS()def check_login(times): """ 校...原创 2020-01-07 09:30:46 · 408 阅读 · 0 评论 -
爬取圣经demo
# coding=utf-8from selenium import webdriverimport timedr = webdriver.Chrome()dr.maximize_window()dr.get("http://www.godcom.net/hhb/")dr.implicitly_wait(20)fr_all = dr.find_element_by_name("...原创 2020-01-07 09:29:47 · 257 阅读 · 0 评论 -
最新版谷歌浏览器设置自动运行flash
我们在用Selenium做自动化测试时,有时候需要浏览器自动加载flash插件,69以前的谷歌浏览器,可以通过加载属性的方法自动运行flash插件,如下:prefs={ "profile.managed_default_content_settings.images":1, "profile.content_settings.plugin_whitelist....原创 2019-12-11 14:38:53 · 2014 阅读 · 0 评论 -
python远程执行selenium代码demo
from selenium.webdriver import Remotefrom threading import Threadimport timedef test(host,dc): dr = Remote(command_executor=host,desired_capabilities=dc) dr.get("https://www.baidu.com")...原创 2019-11-04 13:42:23 · 533 阅读 · 0 评论 -
selenium server下载地址
http://selenium-release.storage.googleapis.com/index.html原创 2019-11-04 10:48:42 · 906 阅读 · 2 评论