webdriver

PhantomJS 与python的结合

我怕爱的太早我们不能终老 提交于 2020-01-15 08:25:25
本文转载自: https://www.cnblogs.com/zzhzhao/p/5380376.html 作者:zzhzhao 转载请注明该声明。 待完善 一.简介 PhantomJS是一个基于webkit的JavaScript API。它使用QtWebKit作为它核心浏览器的功能,使用webkit来编译解释执行JavaScript代码。任何你可以在基于webkit浏览器 做的事情,它都能做到。它不仅是个隐形的浏览器,提供了诸如CSS选择器、支持Web标准、DOM操作、JSON、HTML5、Canvas、SVG等, 同时也提供了处理文件I/O的操作,从而使你可以向操作系统读写文件等。PhantomJS的用处可谓非常广泛,诸如前端无界面自动化测试(需要结合 Jasmin)、网络监测、网页截屏等。 二.PhantomJS安装   我的是win7系统,在下面的网站选择合适的版本安装 http://phantomjs.org/   装好解压后,把文件夹bin中的phantomjs.exe移到 python 文件夹中的Scripts中,至此,就已经在Win的环境下配置好了环境。 三.小测试 from selenium import webdriver driver = webdriver.PhantomJS() driver.get( " http://hotel.qunar.com/ "

Java : For String values we use the command sendKeys(“String”); Similarly what is the command for posting a numeric data to the numeric field

爷,独闯天下 提交于 2020-01-15 06:19:12
问题 Selenium Java Web Driver: How to pass numeric data to a numeric field? For String values we use the command sendKeys("String"); . Similarly, what is the command for posting numeric data to the numeric field? 回答1: If you do sendKeys("9"); it will send the number to the numeric field. I suppose you have something like that: int numberToSend = 9; And you want to send it to numeric field. You can do it by these two ways: String numberToString = "" + numberToSend; And then you can use either

How to click a row that has javascript on click event in RIDE

谁都会走 提交于 2020-01-15 04:15:20
问题 I am trying to click a row that has a javascript onclick function in RIDE IDE by using Robot Frame Work with Selenium2 library. <tr class="lstrow" onclick="javascript:selectItem(this);" onmouseover="javascript:this.className='rowhover';" onmouseout="javascript:this.className='row';"> When i perform click event at following xpath, it says element at path not found. //*[@id="myList"]/tbody/tr[0] By inspecting the element, I can confirm this row is there. Also tried to pin point the 'rowhover'

How to click a row that has javascript on click event in RIDE

▼魔方 西西 提交于 2020-01-15 04:14:27
问题 I am trying to click a row that has a javascript onclick function in RIDE IDE by using Robot Frame Work with Selenium2 library. <tr class="lstrow" onclick="javascript:selectItem(this);" onmouseover="javascript:this.className='rowhover';" onmouseout="javascript:this.className='row';"> When i perform click event at following xpath, it says element at path not found. //*[@id="myList"]/tbody/tr[0] By inspecting the element, I can confirm this row is there. Also tried to pin point the 'rowhover'

Selenium Webdriver and Firefox crashes after download a few CSV files

我只是一个虾纸丫 提交于 2020-01-15 03:10:51
问题 I have problem with download about 20 files (one by one, from one website) using Selenium Webdriver + Firefox (25.0.1), in Python 2.7.6 (Windows), but after download 9-10 files Firefox is blocked and is not responding... this happend every time, really strange for me. How can I fix it? Here is my test code: import time from selenium import webdriver fx = webdriver.FirefoxProfile() fx.set_preference("browser.download.manager.showWhenStarting", False) fx.set_preference("browser.helperApps

Protractor Process exited with error code 100

戏子无情 提交于 2020-01-14 14:07:59
问题 I'm trying to setup protractor on different computer. It is using the same files with my other computer (cannot be used because hdisc corrupted). It run fine on my other computer but I am getting error "Process exited with error code 100" when I tried to run protractor on this one. I've tried to delete the node modules, clean cache and perform npm install again to install the dependencies. It helps my earlier issue (cannot run webdriver) but is now causing me this one. [14:44:09] I/launcher -

selenium+python建立环境和录制脚本

夙愿已清 提交于 2020-01-14 13:13:34
环境的建立 ü 安装JDK 因为之前配置monkeyrunner的环境,JDK已经安装,这里不再赘述 ü 安装Python2.7 需要将python添加到环境变量中(右击计算机->属性->高级系统设置->环境变量->path) 此时直接打开cmd,输入python就应该能调出python的运行环境 ü 安装selenium,使用pip命令安装 下载setuptools for 2.7(不支援python3.2) 安装setuptools,点击exe文件安装,会自动安装到自动安装到python2.7中 下载pip1.3.1 目的:python setup.py install,安装后可以去安装pip工具了 方法:使用CMD命令进入pip解压后的文件夹,然后使用python setup.py install easy_install pip 目的:安装后就可以使用pip命令安装selenium了 方法:进入python/script下执行命令 pip install -U selenium 目的:安装selenium(注意-U是大写) 方法:进入python/script下执行命令 ü 编写简单的脚本,实现打开浏览器并登入指定的网址 from selenium import webdriver browser=webdriver.Firefox() browser.get("http:

Timed out receiving message from renderer

久未见 提交于 2020-01-14 10:42:42
问题 I am trying to get status of transactions from some web portal and I am using below chrome settings in my java application and I am getting Timed out receiving message from renderer: 60.000 and all the pending transactions are timing out. Session info: headless chrome=68.0.3440.75 Driver info: chromedriver=2.38 (0) platform=Linux 2.6.32-696.23.1.el6.x86_64 x86_64) How i can handle this and if any timeout is happening then move to next transaction? I have tried all permutation and combinations

Check if an element has a label in Selenium/WebDriver (Ruby)

不羁的心 提交于 2020-01-14 06:54:08
问题 I have the following HTML code: <input id="session_remember_me" name="session[remember_me]" type="checkbox" value="1" /> <label for="session_remember_me">Remember me</label> I want to check if the session_remember_me field has label Remember me How do I check that? 回答1: I don't know Ruby, but in Java, you could just do the following : boolean isLabelPresent = true; try { driver.findElement(By.xpath("//label[@for='session_remember_me']")); } catch (NoSuchElementException e) { isLabelPresent =

《手牵手带你走进python世界》系列三

你说的曾经没有我的故事 提交于 2020-01-14 04:46:51
day03 selenium 介绍 Selenium 是一个用于Web应用程序测试的工具。Selenium测试直接运行在浏览器中,就像真正的用户在操作一样。支持的浏览器包括IE(7, 8, 9, 10, 11), Mozilla Firefox ,Safari,Google Chrome,Opera等。 驱动对应表 chromedriver版本 支持的Chrome版本 v2.46 v71-73 v2.45 v70-72 v2.44 v69-71 v2.43 v69-71 v2.42 v68-70 v2.41 v67-69 v2.40 v66-68 v2.39 v66-68 v2.38 v65-67 v2.37 v64-66 v2.36 v63-65 v2.35 v62-64 v2.34 v61-63 v2.33 v60-62 v2.32 v59-61 v2.31 v58-60 v2.30 v58-60 v2.29 v56-58 v2.28 v55-57 v2.27 v54-56 v2.26 v53-55 v2.25 v53-55 v2.24 v52-54 v2.23 v51-53 v2.22 v49-52 v2.21 v46-50 v2.20 v43-48 v2.19 v43-47 v2.18 v43-46 v2.17 v42-43 v2.13 v42-45 v2.15 v40