使用Selenium WebDriver在Eclipse中进行调试时,如何解决“找不到源"错误? [英] How do I fix 'Source not found' error when debugging in Eclipse, using Selenium WebDriver?

查看:154
本文介绍了使用Selenium WebDriver在Eclipse中进行调试时,如何解决“找不到源"错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在带有Java的Eclipse中使用Selenium Webdrive构建测试自动化框架,其中一部分是通过编写的代码进行调试,以使我有一个全面的了解(我应该注意,在运行时我在调试模式之外的测试工作正常).我遇到的问题是,在整个调试过程中,我总是在调试模式下遇到找不到源"错误.

I'm practicing building a test automation framework using Selenium Webdrive in Eclipse with Java, and as part of this I'm debugging through the code I have written so that I have a full understanding (I should note that when I run my tests outside of debug mode they work fine). The issue I have is that I keep encountering 'Source not found' errors in debug mode in respect of a whole load of stuff.

我在下面附加了一个屏幕截图,其中显示了我在Eclipse中的调试窗口,并显示了其中一个错误的示例.

I've attached a screenshot below which shows my debug window in Eclipse, and shows an example of one of the errors.

因此,情况是我在运行测试的地方有了TestRunner类(请参见下面的代码)

So, the situation is that I have my TestRunner class from where I am running my tests (see code below)

package dataStructureModel;

import java.util.ArrayList;
import java.util.List;

import org.openqa.selenium.firefox.FirefoxDriver;


public class TestRunner {

public static void main(String[] args) {

    FirefoxDriver driver = new FirefoxDriver();

    List<iTest> tests = new ArrayList<iTest>();

    // adding first test
    tests.add((iTest) new DragDefaultTest001());

    // adding second test
    tests.add((iTest) new ColorCheckTest002());

    BREAKPOINT HERE!
    for(int i = 0; i < tests.size() ; i++)
    {
        iTest currentTest = tests.get(i);
        currentTest.testSetup(driver);
        boolean testResult = currentTest.runTest();
        if(testResult)
        {
            System.out.println(currentTest.testName() + " test passed.");
        }
        else
        {
            System.out.println(currentTest.testName() + " test failed.");
        }
        currentTest.testCleanup();
    }   
   }

}

我已经在'for'循环中设置了一个断点来迭代测试(我没有附加代码,因为正如前面提到的,测试确实可以运行). Firefox浏览器加载完毕,我开始逐步浏览,一切看起来都不错.然后,我打了这些找不到源"错误之一,其中有很多错误.我在此处附有一个屏幕截图,其中提供了一个示例.... http://i.imgur. com/aDxCAX0.png

I've set a breakpoint at the 'for' loop to iterate through my tests (I've not attached the code, given that as mentioned earlier, the tests do run). The Firefox browser loads up and I start stepping through and all looks good. Then I hit one of these 'Source not found' errors', of which there are many. I've attached a screenshot here, which gives an example....http://i.imgur.com/aDxCAX0.png

我知道它要求编辑源查找路径",但是我不确定应该引用什么?据我所知,我已经附加了所有的硒罐文件,所以我不确定哪里出了问题.

I know it asks to 'Edit Source Lookup Path', but I'm not sure what I should be referencing? As far as I'm aware I've attached all the selenium jar files, so I'm not sure where I'm going wrong.

推荐答案

这需要硒罐SOURCE文件.如果您不想看到Selenium Jars的内部零件(这种情况很少见),那么只需Step Over(F6)而不是Step Into(F5)

This needs selenium-jar SOURCE files. In case you do no intend to see internals of Selenium Jars(which is a rare case), then just Step Over(F6) instead of Step Into(F5)

希望这会有所帮助!

这篇关于使用Selenium WebDriver在Eclipse中进行调试时,如何解决“找不到源"错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆