无法调试java selenium TestNG代码逐行eclipse

时间:2016-09-19 18:46:27

标签: java eclipse debugging selenium selenium-webdriver

我知道我的代码出现问题,我想逐行调试来理解代码流。我知道 F5,F6,F7 和步骤过滤器,但我仍然无法逐行调试,因为我

F7 -step return我得到找不到来源 我看到光标仍在同一行34

F6 - 我再次找不到Source 我看到光标仍在同一行34

解决未找到的来源我发布了使用'Step filters'但是徒劳无功 仍然看到新的源未找到的消息,我不能逐行看到我的执行,即每行代码在哪里。我可以通过回到我的代码并忽略新的源未找到窗口来处理未找到的源。

我希望逐行查看程序流程

public class CallUrl {
WebDriver driver;

@BeforeClass
public void openBrowser() throws IOException {
    ChromeOptions options = new ChromeOptions();
    options.addArguments("chrome.switches", "--disable-extensions");
 // BREAKPOINT BELOW    
 driver = new ChromeDriver(options);
}

@AfterClass
public void cleanup() {
    if (driver != null) {
        driver.quit();
    }
}

@Test
public void openURL() throws IOException {
    driver.get("http://newtours.demoaut.com/");
    WebDriverWait myDynamicElement = new WebDriverWait(driver, 30);
    myDynamicElement.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//input[@name='userName']")));
}

//@Test (dependsOnMethods = "openURL")
@Test 
public void loginToTours() throws InterruptedException {
    driver.findElement(By.xpath("//input[@name='userName']")).sendKeys("Tokci");
}

}

enter image description here

0 个答案:

没有答案