此工具应登录经过身份验证的Web应用程序,并递归传递整个Web应用程序链接并查找错误页面或损坏的链接。 我尝试使用Watin实现自己的工作来完成这项工作,但是没有用。
答案 0 :(得分:0)
这可以通过PowerShell IE COM object轻松完成。关于这种自动化(user_agent的实现),这是my article。在你的情况下,你只需要
的第一部分应登录已验证的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()
}
答案 1 :(得分:0)
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>
}
}