【问题标题】:Check links with getAllLinks使用 getAllLinks 检查链接
【发布时间】:2011-06-20 18:57:07
【问题描述】:

我正在使用 selenium ide 和 rc 测试应用程序。我需要验证链接。

通常我将文件从 Selenium ide 导出到 junit 4,然后在 eclipse 中运行文件。文件如下

包 com.example.tests;

导入 com.thoughtworks.selenium.*; 导入 org.junit.After; 导入 org.junit.Before; 导入 org.junit.Test; 导入 java.util.regex.Pattern;

公共类 login_csupport 扩展 SeleneseTestCase { @前 公共无效设置()抛出异常{ selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://daisy-w2003.hi.inet/CustomerSupport"); selenium.start(); }

@Test
public void testLogin_csupport() throws Exception {
    selenium.open("http://daisy-w2003.hi.inet/CustomerSupport/?ReturnUrl=%2fCustomerSupport%2fAccount");
    assertEquals("Calling Cards Customer Support - Inicio", selenium.getTitle());
    selenium.type("UserName", "admin");
    selenium.type("Password", "admin");
    selenium.click("//div[@id='content']/div/form/div[3]/a/span[2]");
    selenium.waitForPageToLoad("30000");
    assertEquals("Calling Cards Customer Support - Gestión", selenium.getTitle());
}

@After
public void tearDown() throws Exception {
    selenium.stop();
}

} 使用 getAllLinks 我想检查页面的链接。拜托,谁能帮帮我??

谢谢

【问题讨论】:

    标签: ide selenium


    【解决方案1】:

    assertAllLinks(pattern)getAllLinks() 生成

    Returns:
    the IDs of all links on the page
    
    Returns the IDs of all links on the page.
    
    If a given link has no ID, it will appear as "" in this array.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-09
      • 1970-01-01
      • 2013-01-31
      • 1970-01-01
      • 1970-01-01
      • 2014-02-12
      • 2015-08-10
      • 1970-01-01
      相关资源
      最近更新 更多