Testing 我正在寻找一个工具来测试从所有链接传递的经过身份验证的web应用程序,并查找错误页面和断开的链接

Testing 我正在寻找一个工具来测试从所有链接传递的经过身份验证的web应用程序,并查找错误页面和断开的链接,testing,automated-tests,Testing,Automated Tests,该工具应该能够登录到经过身份验证的web应用程序中,并递归地通过整个web应用程序链接,找到错误页面或断开的链接。 我试图用Watin实现一个工具来完成这项工作,但没有成功 这可以通过PowerShell轻松完成。这是关于这样的自动化(用户代理的实现)。在您的情况下,您只需要 应该在经过身份验证的web应用程序中登录 其余的 通过递归遍历整个web应用程序链接并查找错误页面或断开的链接 可以使用我共享的代码片段完成。简单代码: //create IE object $ie = New-Objec

该工具应该能够登录到经过身份验证的web应用程序中,并递归地通过整个web应用程序链接,找到错误页面或断开的链接。 我试图用Watin实现一个工具来完成这项工作,但没有成功


这可以通过PowerShell轻松完成。这是关于这样的自动化(用户代理的实现)。在您的情况下,您只需要

应该在经过身份验证的web应用程序中登录

其余的

通过递归遍历整个web应用程序链接并查找错误页面或断开的链接

可以使用我共享的代码片段完成。简单代码:

//create IE object
$ie = New-Object -ComObject InternetExplorer.Application
$ie.Visible = $true
$url = "http://myUrl.com/?Login"
$ie.Navigate($url)
$doc = $ie.Document
//find all links in page
$links = $doc.getElementsByTagName("a")
foreach($link in $links) { 
//or you can call here some function that will check
//each link and can be called recursively for each page afterwards
$.click()
} 
如果您熟悉selenium工具,这个场景可以很容易地通过selenium进行测试。
您只需要下载selenium jar并在使用eclipse的JAVA(可以是任何其他语言)创建的项目中使用它,然后编写一个简单的代码来检查网页上的所有链接。
示例代码可以是:
Webdriver=newfirefoxdriver();
//浏览网址
获取(“输入URL”);
//输入用户名和密码
driver.findElement(By.id(“输入用户id元素定义”)).sendKeys(“输入您的用户名”);
driver.findElement(By.id(“输入密码元素定义”)).sendKeys(“输入您的密码”);
driver.findElement(By.id(“输入提交元素定义”))。单击();
//进入欲望屏幕
driver.findElement(By.id(“输入所需选项元素定义”))。单击();
List webelementList=新建ArrayList;
webelementList=driver.findElements(按.tagName(“a”));
对于(int i=0;i
This scenario can be easily tested by selenium, if you are familiar with Selenium tool.
You just need to download the selenium jar and use this in a project created in JAVA (can be any other language) using eclipse and then write a simple code to check all links on a web page.

Sample code can be:
Webdriver driver = new Firefoxdriver();
//Browse URL
driver.get("ENTER UR URL");

//Enter User name and Password
driver.findElement(By.id("ENTER USER ID ELEMENT DEFINITION")).sendKeys("ENTER UR USER NAME");
driver.findElement(By.id("ENTER PASSWORD ELEMENT DEFINITION")).sendKeys("ENTER UR PASSWORD");
driver.findElement(By.id("ENTER SUBMIT ELEMENT DEFINITION")).click();

//Go To Desire Screen
driver.findElement(By.id("ENTER Desire Option ELEMENT DEFINITION")).click();

List<Webelement> webelementList = new ArrayList<Webelement>;
webelementList = driver.findElements(By.tagName("a"));

for(int i=0; i<webelementList.size(); i++)
{
driver.get(webelementList.get(i));
if(driver.getTitle().equalsIgnoreCase("Page"))
{
<Write Validation>
}
}