gpt4 book ai didi

java - 源附件不包含文件 Throwables.class 的源

转载 作者:行者123 更新时间:2023-12-02 00:36:00 26 4
gpt4 key购买 nike

我尝试在 Eclipse 中运行以下代码,但出现此异常:

Source Attachment does not contain the source for the file Throwables.class.

我尝试更改所需 jar 的路径,但不起作用。

    package automationFramework;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.*;

import org.openqa.selenium.firefox.FirefoxDriver;

public class FirstTestCase {
private static WebDriver driver = null;
public static void main(String[] args) {
// TODO Auto-generated method stub
// Create a new instance of the Firefox driver

driver = new FirefoxDriver();

//Put a Implicit wait, this means that any search for elements on the page could take the time the implicit wait is set for before throwing exception

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

//Launch the Online Store Website

driver.get("http://www.store.demoqa.com");

// Find the element that's ID attribute is 'account'(My Account)

driver.findElement(By.xpath(".//*[@id='account']/a")).click();

// Find the element that's ID attribute is 'log' (Username)

// Enter Username on the element found by above desc.

driver.findElement(By.id("log")).sendKeys("testuser_1");

// Find the element that's ID attribute is 'pwd' (Password)

// Enter Password on the element found by the above desc.

driver.findElement(By.id("pwd")).sendKeys("Test@123");

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

driver.findElement(By.id("login")).click();

// Print a Log In message to the screen

System.out.println(" Login Successfully, now it is the time to Log Off buddy.");

// Find the element that's ID attribute is 'account_logout' (Log Out)

driver.findElement (By.xpath(".//*[@id='account_logout']/a")).click();

// Close the driver

driver.quit();

}

}

最佳答案

看来您还没有向 Eclipse 展示 Java 库的源代码。应该有一个按钮可以搜索它,并且在 JDK 文件中应该有一个 src.zip 文件。

关于java - 源附件不包含文件 Throwables.class 的源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27647709/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com