在运行webdriver时,运行3分钟后,我收到以下异常并且Webdriver崩溃.
我只使用一个webdriver实例和一个FirefoxDriver配置文件.
Exception in thread "main" org.openqa.selenium.WebDriverException:
java.net.BindException: Address already in use: connect
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1',
java.version: '1.6.0_18'
Driver info: driver.version: remote
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:
341)
at
org.openqa.selenium.firefox.FirefoxDriver.execute(FirefoxDriver.java:
234)
at
org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:
173)
at
org.openqa.selenium.remote.RemoteWebDriver.findElementsByXPath(RemoteWebDriver.java:
231)
at org.openqa.selenium.By$6.findElements(By.java:200)
at
org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:
158)
Caused by: java.net.BindException: Address already in use: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at
org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:
123)
at
org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:
133)
at
org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:
149) …
Run Code Online (Sandbox Code Playgroud) 在html标签之间抓取所有文本的最有效方法是什么?
<div>
<a> hi </a>
....
Run Code Online (Sandbox Code Playgroud)
一堆文字被html标签包围.
使用FirefoxDriver编写测试时
我发现由于javascript和css被执行,页面的加载速度非常慢.无论如何要禁用它吗?有可能甚至安装Noscript插件到配置文件?
另外,sendKeys()实际上输出了文本.但是,对于长文本来说这很慢,无论如何要立即在输入框中键入所有字符串?
有时在关闭Javascript的WebDriver上运行测试时,WebDriver在找到元素时会因ElementNotFound错误而崩溃,并尝试单击它.
但是,元素显然在那里!
阅读本文后:http://code.google.com/p/selenium/wiki/FrequentlyAskedQuestions#Q : _My_XPath_finds_elements_in_one_browser,_but_not_in_others._Wh
我得出结论,webdriver必须等到网页完成加载后才能等待.我如何使用Webdriver Wait类?有人能提供一个例子吗?
我有一个非白色区域的图像(例如段落但不处理OCR).这些区域之间的空间有些规律,观看图像的人将能够看到这些区域之间存在白色空间.
我打算做的是找到所有区域的顶角和底角,从底角开始到下一个区域的顶角,获取每条水平线的熵,以及具有最小值的线并返回该线的Y位置.
[region] <--- maximum corner coordinates identified
[line with lowest entropy] <--- return Y position starting from above region's bottom corner's Y coordinate.
[region]<--- stop at Y coordinate of this region's top corner.
Run Code Online (Sandbox Code Playgroud)
我打算做的是裁剪这些地区.
我想到的另一种方法是使用直方图来识别最低点并以某种方式找到最低点的位置.
我遇到了一个我要问自己的场景我是否需要将每个实体(一个Classroom有很多学生)放入单独的Meteor.collection对象中,或者将一组学生嵌入教室对象中并拥有一个Meteor.collection Classroom对象.
我的直觉告诉我将课堂和学生放在他们自己的Meteor.collections中,但我不确定如何在两个Meteor集合对象之间建立一对多的关系.
如果有更多传统的一对多,多对多关系转化为Meteor的做事方式会怎样?
我的问题源于这样一个事实:.aggregate()不受支持,并且意识到如果没有进行递归循环来抓取嵌套和嵌入文档,在存在Meteor集合的父文档中(例如Classroom)是不可能的.
我下载了selenium-java-2.0a5.zip
http://code.google.com/p/selenium/downloads/list
并运行以下代码:
package org.openqa.selenium.example;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
public class Example {
public static void main(String[] args) {
// Create a new instance of the html unit driver
// Notice that the remainder of the code relies on the interface,
// not the implementation.
WebDriver driver = new HtmlUnitDriver();
// And now use this to visit Google
driver.get("http://www.google.com");
// Find the text input element by its name
WebElement element = driver.findElement(By.name("q"));
// Enter something to …
Run Code Online (Sandbox Code Playgroud) 在外部服务上生成pdf,我想将流式传输到我的php服务器的浏览器,同时流式传输到客户端,这样我就不需要从远程文件下载pdf,然后开始初始化下载.我会立即将文件下载或流式传输到请求它的客户端.