首页 文章

检查与getAllLinks的链接

提问于
浏览
0

我用selenium ide和rc测试应用程序 . 我需要验证链接 .

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

package com.example.tests;

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

public class login_csupport extends SeleneseTestCase {@Before public void setUp()throws Exception {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我想检查一下页面的链接 . 拜托,有谁可以帮帮我?

谢谢

1 回答

  • 2

    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.
    

相关问题