Original author: [email protected] (January 10, 2011 15:19:26)
What steps will reproduce the problem?
- Deployed the attached web application in your web server
- Run the below mentioned program in Firefox
public class TestCrawljax {
public static void main(String[] args) {
CrawlSpecification crawler = new CrawlSpecification(
"http://localhost:8080/sampleApp");
crawler.setClickOnce(false);
crawler.setRandomInputInForms(false);
crawler.clickDefaultElements();
crawler.setWaitTimeAfterEvent(1000);
crawler.setWaitTimeAfterReloadUrl(1000);
CrawljaxConfiguration config = new CrawljaxConfiguration();
config.setCrawlSpecification(crawler);
//config.setBrowser(BrowserType.ie);
try {
CrawljaxController crawljax = new CrawljaxController(config);
crawljax.run();
} catch (Exception e) {
e.printStackTrace();
}
}
}
What is the expected output? What do you see instead?
It should click on the single link mentioned in the index page in Firefox. However in Firefox it is not clicking on that link however in case of IE it is clicking on the link.
What version of the product are you using? On what operating system?
Crawljax 2.0
Windows XP
Firefox 3.0
IE 7
Please provide any additional information below.
I have also tried the same thing with WebDriver using the following program, there it has worked fine.
public class TestWebDriver {
public static void main(String[] args) throws Exception {
WebDriver driver = new FirefoxDriver();
driver.get("http://localhost:8080/sampleApp");
driver.findElement(By.linkText("HelloWorld")).click();
driver.close();
}
}
Here is the crawljax.com output for both Firefox & IE
Firefox output:
Starting Crawljax...
Used plugins:
No plugins loaded because CrawljaxConfiguration is empty
Embedded browser implementation: firefox
Number of threads: 1
Crawl depth: 0
Crawljax initialized!
Start crawling with 4 crawl elements
Starting new Crawler: Thread 1 Crawler 1 (initial)
Running PreCrawlingPlugins...
Running OnBrowserCreatedPlugins...
Loading Page http://localhost:8080/sampleApp
Running OnUrlLoadPlugins...
Running OnNewStatePlugins...
Looking in state: index for candidate elements with
TAG: A
Found new candidate element: A: href=HelloWorld.html xpath /HTML[1]/BODY[1]/TABLE[1]/FORM[1]/TBODY[1]/TR[1]/TD[1]/A[1]
TAG: BUTTON
TAG: INPUT: type="submit"
TAG: INPUT: type="button"
Found 1 new candidate elements to analyze!
Starting preStateCrawlingPlugins...
Running PreStateCrawlingPlugins...
Executing click on element: "HelloWorld" A: href="HelloWorld.html" click xpath /HTML[1]/BODY[1]/TABLE[1]/FORM[1]/TBODY[1]/TR[1]/TD[1]/A[1]; State: index
Could not fire eventable: "HelloWorld" A: href="HelloWorld.html" click xpath /HTML[1]/BODY[1]/TABLE[1]/FORM[1]/TBODY[1]/TR[1]/TD[1]/A[1]
Running OnFireEventFailedPlugins...
Finished executing
All Crawlers finished executing, now shutting down
CrawlerExecutor terminated
Running PostCrawlingPlugins...
Total Crawling time(14390ms) ~= 0 min, 14 sec
EXAMINED ELEMENTS: 1
CLICKABLES: 0
STATES: 1
Dom average size (byte): 346
DONE!!!
IE output:
Starting Crawljax...
Used plugins:
No plugins loaded because CrawljaxConfiguration is empty
Embedded browser implementation: ie
Number of threads: 1
Crawl depth: 0
Crawljax initialized!
Start crawling with 4 crawl elements
Starting new Crawler: Thread 1 Crawler 1 (initial)
Running PreCrawlingPlugins...
Running OnBrowserCreatedPlugins...
Loading Page http://localhost:8080/sampleApp
Running OnUrlLoadPlugins...
Running OnNewStatePlugins...
Looking in state: index for candidate elements with
TAG: A
Found new candidate element: A: href=HelloWorld.html xpath /HTML[1]/BODY[1]/TABLE[1]/FORM[1]/TBODY[1]/TR[1]/TD[1]/A[1]
TAG: BUTTON
TAG: INPUT: type="submit"
TAG: INPUT: type="button"
Found 1 new candidate elements to analyze!
Starting preStateCrawlingPlugins...
Running PreStateCrawlingPlugins...
Executing click on element: "HelloWorld" A: href="HelloWorld.html" click xpath /HTML[1]/BODY[1]/TABLE[1]/FORM[1]/TBODY[1]/TR[1]/TD[1]/A[1]; State: index
Dom is Changed!
Correcting state name from state2 to state1
State state1 added to the StateMachine.
StateMachine's Pointer changed to: state1
StateMachine's Pointer changed to: state1 FROM index
Running OnNewStatePlugins...
Running GuidedCrawlingPlugins...
RECURSIVE Call crawl; Current DEPTH= 1
Looking in state: state1 for candidate elements with
TAG: A
TAG: BUTTON
TAG: INPUT: type="submit"
TAG: INPUT: type="button"
Found 0 new candidate elements to analyze!
StateMachine's Pointer changed to: index
Finished executing
All Crawlers finished executing, now shutting down
CrawlerExecutor terminated
Running PostCrawlingPlugins...
Interaction Element= "HelloWorld" A: href="HelloWorld.html" click xpath /HTML[1]/BODY[1]/TABLE[1]/FORM[1]/TBODY[1]/TR[1]/TD[1]/A[1]
Total Crawling time(12375ms) ~= 0 min, 12 sec
EXAMINED ELEMENTS: 1
CLICKABLES: 1
STATES: 2
Dom average size (byte): 289
DONE!!!
Original issue: http://code.google.com/p/crawljax/issues/detail?id=42