- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我不想在这里做太多事情。
我只是想运行 Selenium 网站中给出的示例,只需打开 Google 页面并在编辑框中输入搜索字符串
但我收到以下错误:
*> 线程“main”中的异常
java.lang.NoClassDefFoundError: org/apache/http/client/ClientProtocolException at org.openqa.selenium.ie.InternetExplorerDriver.setup(InternetExplorerDriver.java:92) at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:56) at com.testscripts.Selenium2Example.main(Selenium2Example.java:16)*
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
//import org.openqa.selenium.ie.*;
public class Selenium2Example {
public static void main(String[] args) {
// Create a new instance of the Firefox driver
// Notice that the remainder of the code relies on the interface,
// not the implementation.
System.setProperty("webdriver.firefox.bin", "C:\\Documents and Settings\\Vikas Kashyap\\Local Settings\\Application Data\\Mozilla Firefox\\firefox");
WebDriver driver = new FirefoxDriver();
//WebDriver driver = new InternetExplorerDriver();
// 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 search for
element.sendKeys("Cheese!");
// Now submit the form. WebDriver will find the form for us from the element
element.submit();
// Check the title of the page
System.out.println("Page title is: " + driver.getTitle());
//Close the browser
driver.quit();
}
}
最佳答案
谢谢回复。
我发现了我所犯的错误。
我使用 Eclipse 作为我的 IDE。
在外部引用的 JAR 文件列表中,我包含了“selenium-java-2.0b3.jar”
实际上我必须包括“selenium-server-standalone-2.0b3.jar”
Selenium 网站并没有真正说明要为服务器下载哪个 jar 文件!这造成了所有的困惑。
使用正确的 jar 文件,不再有 "NoClassDefFoundError"。
问候
维卡斯
关于selenium - NoClassDefFoundError : org/apache/http/HttpEntity in Selenium for FirefoxDriver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6018275/
我正在尝试模拟泛型我能够模拟一些泛型表达式,但我不知道如何模拟泛型初始化 最佳答案 Java 中的泛型是使用删除实现的编译器技巧(可以选择一些运行时工件,这是真的)。因此 HttpEntity 并没有
我想创建一个带有我传递的类类型的 HttpEntity。我正在尝试做如下的事情: private HttpEntity createRequestEntity(String
我的rest api使用带有2个对象参数的POST请求:自定义类型和long 我可以将一个参数链接到正文,如下所示: private void createCaseParticipant(long c
我的 Android 应用程序上有一个忘记密码的页面。如果我没有输入电子邮件,它会从服务器返回正确的响应,如果我输入的电子邮件是在我们的数据库中找到的,那么它会向用户发送一封电子邮件并从服务器返回正确
我正在使用版本 4.3.3 的 Apache HttpClient API。当我执行以下语句时,它返回 HttpResponse 实例。 HttpResonse response = httpClie
嗨,我正在尝试使用 post 方法使用 apatche 4.0.1 in this example但我得到了 HttpEntity ClassNotFound 异常 最佳答案 您不正确地将 httpc
我正在尝试更新到 com.loopj.android:android-async-http 的最新版本 (1.4.9),其中 org.apache.http替换为 cz.msebera.android
我正在尝试运行 documentation 中的简单示例没有任何变化: import spray.json.DefaultJsonProtocol import spray.httpx.unmarsh
我有一个带有 HttpEntity 的 HttpResponse(全部来自 org.apache.http)。 我的 HttpEntity 有一些 application/json 内容,我想在转发之
这个问题已经有答案了: What exactly is an HTTP Entity? (11 个回答) 已关闭 7 年前。 我已经阅读了有关 HttpEntity 的 spring 文档。因此,它代
我正在尝试使用 jakarta commons HttpClient 库。 我想我在这里很蠢,但我不知道如何将完整的 HttpEntity 写入文件。 我正在尝试: FileOutputStream
我正在使用 apache httpclient (4.x) 为我的 REST web 服务编写一个 REST 客户端。我正在使用 JAXB (JSON) 进行请求/响应。在我的一个网络服务中,我有一个
在 android API 7+ 中有什么方法可以报告对 HttpEntity.getContent() 的调用进度? 在我的例子中,我在响应流中获取图像,因此传输可能需要相当长的时间。我想要一个样式
我正在尝试使用 this 学习 XML 解析教程,但有些类(class)没有被导入。这是代码: public String getXmlFromUrl(String url) { String
我有以下代码: HttpClient FETCHER HttpResponse response = FETCHER.execute(host, httpMethod); 我正在尝试将其内容读取为这样
我正在做一个小应用程序,它接收一些带有 UTF-8 编码的 XML,浏览器中完全相同的 XML 正确呈现字符,而在 Android 中我有一些“垃圾”,例如。 WÅochy 而不是 Włochy 或
我想执行带有主体的 HTTP DELETE 请求。我正在使用 Spring 框架。 为此,我必须进行以下修改: RestTemplate _deleteManager; _deleteManager
我遇到过 EntityUtils.consume(httpEntity);,但我不确定它的真正作用。 例如: try { //... some code HttpEntity http
我正在使用 akka.http.scaladsl.model.HttpResponse、HttpEntity。 得到 response 后,它是格式的 responseEntity 类型 (Conte
我有以下 Java 代码: HttpResponse response = httpClient.execute(request); HttpEntity entity = response.getE
我是一名优秀的程序员,十分优秀!