0

I started with HtmlUnit recently, had some success scraping some pages and interacting with it, really powerful tool...

But, as far as my knowledge goes, I just retrieved a page with a certain state... My next step is to make HtmlUnit to read the messages from a chat room, constantly, and store/do something when a certain string/regexp matches. I was thinking even about interacting with the chat room.

I'm not sure if HtmlUnit goes that far, I did some research and found something about webDriver, webWindow, etc, maybe I will need to work with Threads to do this....

Can you guys point me in the right direction?

Thank you very much

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
Tacca
  • 149
  • 14
  • To ask if HTMLUnit would do that, first ask how HTMLUnit does what it currently does. Do you think that it knows how to read some file while it is still open? Or what about a data stream that isn't even really in a file (specifically an HTML file)? – Rabbit Guy Jul 12 '16 at 15:17

1 Answers1

0

HtmlUnit tries to simulate as much as possible of real browsers behavior.

If the target website is simple, then HtmlUnit would work. But in some cases, the website is too complex for the current HtmlUnit, you need to isolate a root cause to be fixed.

You can start with WebDriver, and you can easily change the implementation from e.g. ChromeDriver/FirefoxDriver to HtmlUnitDriver with a single line change.

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56