crawljax / crawljax

Crawljax
Apache License 2.0
513 stars 219 forks source link

crawler.dontClick("input") is not working in Crawljax 1.9 #39

Closed alexnederlof closed 11 years ago

alexnederlof commented 12 years ago

Original author: erniting...@gmail.com (December 27, 2010 06:42:32)

What steps will reproduce the problem?

  1. Deploy the attached war file in Tomcat
  2. Run the below mentioned program on that web application

import com.crawljax.browser.EmbeddedBrowser.BrowserType; import com.crawljax.core.CrawljaxController; import com.crawljax.core.configuration.CrawlSpecification; import com.crawljax.core.configuration.CrawljaxConfiguration;

public class TestCrawljax {

public static void main(String[] args) {
    CrawlSpecification crawler = new CrawlSpecification(
            "http://localhost:8080/iframe/index.html");

    crawler.clickDefaultElements();
    crawler.setRandomInputInForms(true);
    crawler.setWaitTimeAfterEvent(1000);
    crawler.setWaitTimeAfterReloadUrl(1000);
    crawler.dontClick("input");

    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 not click on input button however it is clicking on input buttons.

What version of the product are you using? On what operating system? Crawljax 1.9 Windows XP

Please provide any additional information below. Am I missing anything here?

Original issue: http://code.google.com/p/crawljax/issues/detail?id=39

alexnederlof commented 12 years ago

From erniting...@gmail.com on December 27, 2010 06:50:39 I am facing this problem in Firefox and as well as in IE.

alexnederlof commented 12 years ago

From erniting...@gmail.com on January 06, 2011 11:01:20 Any update on this?

alexnederlof commented 12 years ago

From frankgroeneveld on January 07, 2011 07:01:48 Can you post the log file?

alexnederlof commented 12 years ago

From erniting...@gmail.com on January 07, 2011 12:43:15 Starting Crawljax... Used plugins: No plugins loaded because CrawljaxConfiguration is empty Embedded browser implementation: firefox Crawl depth: 0 Crawljax initialized! Running PreCrawlingPlugins... Loading Page http://localhost:8080/iframe/index.html Running OnUrlLoadPlugins... Running OnNewStatePlugins... Start crawling with 4 crawl elements Looking in state: index for candidate elements with TAG: A Found new candidate element: A: href=./page2.html xpath /HTML[1]/BODY[1]/A[1] TAG: BUTTON TAG: INPUT: type="submit" Found new candidate element: INPUT: type=submit value=Submit xpath /HTML[1]/BODY[1]/FORM[1]/INPUT[2] TAG: INPUT: type="button" Found new candidate element: INPUT: class=btn id=button1 name=firstButton onclick=toggle1(); style=display: block; type=button value=Click Me ! xpath /HTML[1]/BODY[1]/INPUT[1] Found new candidate element: INPUT: class=btn id=button2 name=secondButton onclick=toggle2(); style=display: block; type=button value=Click Me Too! xpath /HTML[1]/BODY[1]/INPUT[2] Found new candidate element: INPUT: class=btn id=button3 name=thirdButton onclick=toggle3(); style=display: block; type=button value=Move to page2 xpath /HTML[1]/BODY[1]/INPUT[3] Found 5 new candidate elements to analyze! Running PreStateCrawlingPlugins... Executing click on element: "page2" A: href="./page2.html" click xpath /HTML[1]/BODY[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 Found new candidate element: A: href=./index.html xpath /HTML[1]/BODY[1]/A[1] TAG: BUTTON TAG: INPUT: type="submit" TAG: INPUT: type="button" Found new candidate element: INPUT: class=btn id=button3 name=thirdButton onclick=toggle3(); style=display: block; type=button value=Move to index xpath /HTML[1]/BODY[1]/INPUT[3] Found 2 new candidate elements to analyze! Running PreStateCrawlingPlugins... Executing click on element: "index" A: href="./index.html" click xpath /HTML[1]/BODY[1]/A[1]; State: state1 Dom is Changed! CLONE State detected: state2 and index are the same. StateMachine's Pointer changed to: index StateMachine's Pointer changed to: index FROM state1 Cannot change To state: index From: index Finished executing Reloading page for navigating back since browser is not initialized. Loading Page http://localhost:8080/iframe/index.html Running OnUrlLoadPlugins... Backtracking by executing click on element: "page2" A: href="./page2.html" click xpath /HTML[1]/BODY[1]/A[1] StateMachine's Pointer changed to: state1 Running OnRevisitStatePlugins... Running PreStateCrawlingPlugins... Executing click on element: INPUT: class="btn" id="button3" name="thirdButton" onclick="toggle3();" style="display: block;" type="button" value="Move to index" click xpath /HTML[1]/BODY[1]/INPUT[3]; State: state1 Dom is Changed! CLONE State detected: state3 and index are the same. StateMachine's Pointer changed to: index StateMachine's Pointer changed to: index FROM state1 Finished executing Reloading page for navigating back since browser is not initialized. Loading Page http://localhost:8080/iframe/index.html Running OnUrlLoadPlugins... Running PreStateCrawlingPlugins... Executing click on element: INPUT: type="submit" value="Submit" click xpath /HTML[1]/BODY[1]/FORM[1]/INPUT[2]; State: index Dom Not Changed! Executing click on element: INPUT: class="btn" id="button1" name="firstButton" onclick="toggle1();" style="display: block;" type="button" value="Click Me !" click xpath /HTML[1]/BODY[1]/INPUT[1]; State: index Dom is Changed! Correcting state name from state5 to state2 State state2 added to the StateMachine. StateMachine's Pointer changed to: state2 StateMachine's Pointer changed to: state2 FROM index Running OnNewStatePlugins... Running GuidedCrawlingPlugins... RECURSIVE Call crawl; Current DEPTH= 1 Looking in state: state2 for candidate elements with TAG: A TAG: BUTTON TAG: INPUT: type="submit" TAG: INPUT: type="button" Found new candidate element: INPUT: class=btn id=button1 name=firstButton onclick=toggle1(); style=display: block; type=button value=I'm clicked xpath /HTML[1]/BODY[1]/INPUT[1] Found 1 new candidate elements to analyze! Running PreStateCrawlingPlugins... Executing click on element: INPUT: class="btn" id="button1" name="firstButton" onclick="toggle1();" style="display: block;" type="button" value="I'm clicked" click xpath /HTML[1]/BODY[1]/INPUT[1]; State: state2 Dom is Changed! CLONE State detected: state3 and index are the same. StateMachine's Pointer changed to: index StateMachine's Pointer changed to: index FROM state2 Cannot change To state: index From: index Finished executing Reloading page for navigating back since browser is not initialized. Loading Page http://localhost:8080/iframe/index.html Running OnUrlLoadPlugins... Running PreStateCrawlingPlugins... Executing click on element: INPUT: class="btn" id="button2" name="secondButton" onclick="toggle2();" style="display: block;" type="button" value="Click Me Too!" click xpath /HTML[1]/BODY[1]/INPUT[2]; State: index Dom is Changed! Correcting state name from state4 to state3 State state3 added to the StateMachine. StateMachine's Pointer changed to: state3 StateMachine's Pointer changed to: state3 FROM index Running OnNewStatePlugins... Running GuidedCrawlingPlugins... RECURSIVE Call crawl; Current DEPTH= 1 Looking in state: state3 for candidate elements with TAG: A TAG: BUTTON TAG: INPUT: type="submit" TAG: INPUT: type="button" Found new candidate element: INPUT: class=btn disabled= id=button2 name=secondButton onclick=toggle2(); style=display: block; type=button value=Click Me Too! xpath /HTML[1]/BODY[1]/INPUT[2] Found 1 new candidate elements to analyze! Running PreStateCrawlingPlugins... Executing click on element: INPUT: class="btn" disabled="" id="button2" name="secondButton" onclick="toggle2();" style="display: block;" type="button" value="Click Me Too!" click xpath /HTML[1]/BODY[1]/INPUT[2]; State: state3 Dom Not Changed! StateMachine's Pointer changed to: index Finished executing Reloading page for navigating back since browser is not initialized. Loading Page http://localhost:8080/iframe/index.html Running OnUrlLoadPlugins... Running PreStateCrawlingPlugins... Executing click on element: INPUT: class="btn" id="button3" name="thirdButton" onclick="toggle3();" style="display: block;" type="button" value="Move to page2" click xpath /HTML[1]/BODY[1]/INPUT[3]; State: index Dom is Changed! CLONE State detected: state5 and state1 are the same. StateMachine's Pointer changed to: state1 StateMachine's Pointer changed to: state1 FROM index Finished executing All Crawlers finished executing, now shutting down CrawlerExecutor terminated Closing the browser... Interaction Element= "page2" A: href="./page2.html" click xpath /HTML[1]/BODY[1]/A[1] Interaction Element= "index" A: href="./index.html" click xpath /HTML[1]/BODY[1]/A[1] Interaction Element= INPUT: class="btn" id="button3" name="thirdButton" onclick="toggle3();" style="display: block;" type="button" value="Move to index" click xpath /HTML[1]/BODY[1]/INPUT[3] Interaction Element= INPUT: class="btn" id="button1" name="firstButton" onclick="toggle1();" style="display: block;" type="button" value="Click Me !" click xpath /HTML[1]/BODY[1]/INPUT[1] Interaction Element= INPUT: class="btn" id="button1" name="firstButton" onclick="toggle1();" style="display: block;" type="button" value="I'm clicked" click xpath /HTML[1]/BODY[1]/INPUT[1] Interaction Element= INPUT: class="btn" id="button2" name="secondButton" onclick="toggle2();" style="display: block;" type="button" value="Click Me Too!" click xpath /HTML[1]/BODY[1]/INPUT[2] Interaction Element= INPUT: class="btn" id="button3" name="thirdButton" onclick="toggle3();" style="display: block;" type="button" value="Move to page2" click xpath /HTML[1]/BODY[1]/INPUT[3] Total Crawling time(25047ms) ~= 0 min, 26 sec EXAMINED ELEMENTS: 19 CLICKABLES: 7 STATES: 4 Dom average size (byte): 1371 Running PostCrawlingPlugins... DONE!!!

alexnederlof commented 12 years ago

From erniting...@gmail.com on January 20, 2011 10:26:43 Same problem in Crawljax 2.0

zmoshansky commented 11 years ago

The attachments linked from google code don't seem to exist in this post and the original link is now unreachable. Is it possible to have them [WAR file] attached? This seems to affect many of the backport issues from google code

amesbah commented 11 years ago

The google code project has been deleted and we don't have that information any longer unfortunately.

alexnederlof commented 11 years ago

Outdated