Selendroid Android Studio:没有Lorg / apache / http / message / BasicLineFormatter类型的静态字段INSTANCE

时间:2018-11-03 20:51:23

标签: java android selenium web-scraping selendroid

我正在使用Android Studio中的Selendroid使用WebDriver运行一个简单的测试。我遇到了这个错误:

java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/message/BasicLineFormatter; in class Lorg/apache/http/message/BasicLineFormatter; or its superclasses (declaration of 'org.apache.http.message.BasicLineFormatter' appears in /system/framework/org.apache.http.legacy.boot.jar)

这是我到目前为止所拥有的:

public class MainActivity extends AppCompatActivity {

private TextView textView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    textView = (TextView) findViewById(R.id.tv);

    WebDriver driver = new RemoteWebDriver(DesiredCapabilities.android());

    driver.get("http://m.ebay.de");

    // Find the text input element by its id
    WebElement element = driver.findElement(By.id("kw"));

    // Enter something to search for
    element.sendKeys("Nexus 5");

    // Now submit the form. WebDriver will find the form for us from the element
    element.submit();

    textView.setText(driver.getTitle());

    // Check the title of the page

    driver.quit();
}
}

请帮助我。

0 个答案:

没有答案